How do I redirect index.html to the root / ?
-
The site I've inherited had operated on index.html at one point, and now uses index.php for the home page, which goes to the / page. The index.html was lost in migrating server hosts.
How do I redirect the index.html to the / page? I've tried different options that keep giving ending up with the same 404 error. I tried a redirect from index.html to index.php which ended in an infinite loop. Because the index.html no longer exists in the root, should I created it and then add a redirect to it? Can I avoid this by editing the .htaccess?
Any help is appreciated, thanks in advance!
-
The 301 should be outside the <ifmodule>. Maybe you could post the other 301 redirects and the one which isn't working here.</ifmodule>
Creating a new index.html and redirecting from it would give you a 302 or even a meta-redirect, which in regard to seo is not recommended.
-
I have some re-write rules for Wordpress, which are contained within <ifmodule>tags. And below those I have some redirect 301s. I placed the code after the Wordpress re-writes, and then tried to place them at the end, past the 301 redirects, and still I receive a 404 on the index.html.</ifmodule>
Is there anything else I could be doing? Should I create a new index.html and place a redirect within there?
-
Do you allready have some rewrite-rules in yout htaccess? In this case try placing it at the end of them.
Works without any tags for me.
-
I pasted the code into my .htaccess, and still receive a 404 for index.html. Must it be placed within module tags? Does the position of placement matter? Thanks for the quick reply, btw.
-
Pascal,
chrwald is referring to a 301 redirect, which is safe for seo and should not result in an infinite loop. I've done this myself to redirect the .index.html to the root so that duplicate content would not appear. -
Hi Pascal,
Try this in you htaccess
RewriteEngine on
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index.html\ HTTP/
RewriteRule ^index.html$ http://YOURDOMAIN.COM/ [R=301,L]
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
Redirect indexed lightbox URLs?
Hello all, So I'm doing some technical SEO work on a client website and wanted to crowdsource some thoughts and suggestions. Without giving away the website name, here is the situation: The website has a dedicated /resources/ page. The bulk of the Resources are industry definitions, all encapsulated in colored boxes. When you click on the box, the definition opens in a lightbox with its own unique URL (Ex: /resources/?resource=augmented-reality). The information for these colored lightbox definitions is pulled from a normal resources page (Ex: /resources/augmented-reality/). Both of these URLs are indexed, leading to a lot of duplicate indexed content. How would you approach this? **Things to Consider: ** -Website is built on Wordpress with a custom theme.
Technical SEO | | Alces
-I have no idea how to even find settings for the lightbox (will be asking the client today).
-Right now my thought is to simply disallow the lightbox URL in robots.txt and hope Google will stop crawling and eventually drop from the index.
-I've considered adding the main resource page canonical to the lightbox URL, but it appears to be dynamically created and thus there is no place to access (outside of the FTP, I imagine?). I'm most rusty with stuff like this, so figured I'd appeal to the masses for some assistance. Thanks! -Brad0 -
Confused about repeated occurences of URL/essayorg/topic/ showing up as 404 errors in our site logs
Working on a Wordpress website, https://thedoctorwithin.comScanning the site’s 404 errors, I’m seeing a lot of searches for URL/essayorg/topic, coming from Bingbot, as well as other spiders (Google, OpensiteExlorer). We get at least 200 of these irrelevant requests per week. Seems like each topic that follows /essayorg/ is unique. Some include typos: /dissitation/Haven't done a verification to make sure the spiders are who they say they are, yet.Almost seems like there are many links ‘in the wild’ intended for Essay.Org that are being directed towards the site I’m working on.I've considered redirecting any requests for URL/essayorg/ to our sitemap… figuring that might encourage further spidering of actual site content. Is redirection to our sitemap xml file a good idea, or might doing so have unintended consequences? Interested in suggestions about why this might be occurring. Thank you.
Technical SEO | | linkjuiced0 -
Subdomain redirect
Hey guys, I was thinking about creating subdomains for one of my websites. I want to divide my website in different subdomains (blog.[site].com / directory.[site].com / etc.) but I'm afraid that this will negatively impact my rankings. My blog for example has a lot of supporting content for my products and services that are primarily hosted on the homepage. Have you guys ever created subdomains at a later stage of your website's existence? What kind of impact did you notice? Would you recommend it? Thanks a million!
Technical SEO | | Nizar.1 -
301 redirect Question
Hi all, I have a client who has a domain lets say www.xyz.de which is redirected 301 to www.zyx.de. Now they're working on a relaunch and they want to use the www.xyz.de as their origibnal doman after that. So, at the end the www.zyx.de - which is indexed by Google - should be redirected to www.xyz.de. It vice versa. So the redirect becomes the original and the original becomes the redirect 😕 Is there anything we have to care off? Or will that run into the hell? Thanx. Seb.
Technical SEO | | TheHecksler0 -
Redirects - How Best to do this ?
Hi I am looking to close Website A which has many pages. I would like to keep the home page and add some great content to it with a link pointing to Website B. As for all the other pages excluding the home page , how is it best to approach them on Website A. Should I redirect them all to the home page of Website A which will tell Google thoose Pages are no longer needed and to prevent the visitors from seeing a 404? My Main aim here is to not lose any visitors to Website A by sending them to Website B but also to hopefully pass any Page strength from Website A to Website B Thanks Adam
Technical SEO | | AMG1000 -
Redirecting root to /default.aspx
Hello, I have a client who's home page redirects to /default.aspx - what are the possible SEO impacts of this? As the home page redirects to /default.aspx and does not load under both there does not seem to be a duplicate content issue. Also the redirect should carry over most of the link juice from the home page to /default.aspx therefore are there any negative SEO "side effects" of this set-up? Thanks in advance!
Technical SEO | | RikkiD220 -
Indexing Issue
Hi, I am working on www.stjohnswaydentalpractice.co.uk Google only seems to be indexing two of the pages when i search site:www.stjohnswaydentalpractice.co.uk I have added the site to webmaster tools and created a new sitemap which is showing that it has only submitted two of the pages. Can anyone shed any light for why these pages are not being indexed? Thanks Faye
Technical SEO | | dentaldesign0 -
Url canonicalization: www. to http://
Hey there. Sorry for the simple question but I recently redesigned a site and published with WordPress, in the process the domain structure changed from being www. to http:// . My question is does this change affect the value we get from links pointing to the old www. domain structure? The reason I ask is that the old site had a domain authority of 36 with OSE and a couple of hundred links but the new site address shows as having zero domain authority and zero links. Is there some best practise I should be following to retain link value?
Technical SEO | | Luia0