Redirecting index.html to the root
-
Hi, I was wondering if there is a safe way to consolidate link juice on a single version of a home page. I find incoming links to my site that link to both mysite.com/ and mysite.com/index.html. I've decided to go with mysite.com/ as my main and only URL for the site and now I'd like to transfer all link juice from mysite.com/index.html to mysite.com/
When i tried 301 redirect from index.html to the root it created an indefinite loop, of course.I know I can use a RewriteRule.., but will it transfer the juice??
Please help!
-
@streamlinemetrics this worked for my site Finbit Solutions, too! Thank you very much!
-
It works good for my site https://uaedesertsafari.com/
-
works, thank you!
-
Thank you very much, this works fine with me.
-
Google may see this as a 301 but MOZ crawl does not seem to.
Can you please help explain this?I am looking for a good .htaccess code for this redirect.
-
Thank you, Streamline Metrics. I looked everywhere and tried several different edits in my htaccess for a 301 redirect from index.html to root, but none worked. Your code worked wonderfully.
-
that seems to be working well. thanks a lot for your help.
-
If you want to redirect all index.html(s) to their roots, then try this code -
RewriteEngine On
RewriteRule ^index.html$ / [R=301,L]
RewriteRule ^(.*)/index.html$ /$1/ [R=301,L]And yes, Google will treat them as 301 redirects so your juice will be transferred and consolidated.
-
thanks, that was quick!
A couple of questions before i go ahead and implement it:will this rule re-direct all index.html(s) to their appropriate roots or will it work just for the home page?
Also, as far as user's expirience is concerned this will take care of redirecting requests to show index.html to the root, but what about the juice transfer. Will Google treat it as 301? -
It's definitely a good idea to 301 redirect index.html to your root to consolidate link juice. I am assuming you have an .htaccess file so the following lines should work -
RewriteEngine On
RewriteBase /redirect html pages to the root domain
RewriteRule ^index.html$ / [NC,R,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
-
To remove or not remove a redirected page from index
We have a promotion landing page which earned some valuable inbound links. Now that the promotion is over, we have redirected this page to a current "evergreen" page. But in the search results page on Google, the original promotion landing page is still showing as a top result. When clicked, it properly redirects to the newer evergreen page. But, it's a bit problematic for the original promo page to show in the search results because the snippet mentions specifics of the promo which is no longer active. So, I'm wondering what would be the net impact of using the "removal request " tool for the original page in GSC. If we don't use that tool, what kind of timing might we expect before the original page drops out of the results in favor of the new redirected page? And if we do use the removal tool on the original page, will that negate what we are attempting to do by redirecting to the new page, with regard to preserving inbound link equity?
Intermediate & Advanced SEO | | seoelevated0 -
Multilingual Redirection
Hey there awesome Mozzers, I have a site that it automatically redirects people by using geolocation ( i know that probably is not good ) to the various languages of the site. I just wanted to know Is 301 or 302 the best option? ( I've heard that for language re-directions 302 is the best case scenario ) My main page for example is www.example.com and it automatically redirects with a 301 to www.example.com/en for any language that is not there. What is the best case scenario? Leave it to redirect to /en or just leave it go to the root page www.example.com.
Intermediate & Advanced SEO | | Angelos_Savvaidis0 -
Does Google still don't index Hashtag Links ? No chance to get a Search Result that leads directly to a section of a page? or to one of numeras Hashtag Pages in a single HTML page?
Does Google still don't index Hashtag Links ? No chance to get a Search Result that leads directly to a section of a page? or to one of numeras Hashtag Pages in a single HTML page? If I have 4 or 5 different hashtag link section pages , consolidated into one HTML Page, no chance to get one of the Hashtag Pages to appear as a search result? like, if under one Single Page Travel Guide I have two essential sections: #Attractions #Visa no chance to direct search queries for Visa directly to the Hashtag Link Section of #Visa? Thanks for any help
Intermediate & Advanced SEO | | Muhammad_Jabali0 -
Redirection question
How would I redirect this URL: http://www.members.mysite.com/ to this URL: http://www.mysite.com/ ? I cant figure it out
Intermediate & Advanced SEO | | JohnPeters0 -
Create a link or redirect?
We have 60 demo movie pages on our site. We no longer link to these movie pages internally, because they are outdated; however, a lot of our partner companies are still linking to these pages. Some of these pages will have 10-15 linking root domains and a page authority of 30+... so pretty decent authority. These pages only include a movie on the pages, no links. I am trying to pass some of the link juice from these pages to other pages on our site. I am wondering if I should: A)Include transcripts on these pages, then link back to our current product page or solution pages? B)Set up redirects from these pages to a product or solution page? C)Set up a redirect to our homepage? Any advice? Thanks, Mike
Intermediate & Advanced SEO | | Mike.Goracke0 -
Yoast SEO Plugin: To Index or Not to index Categories?
Taking a poll out there......In most cases would you want to index or NOT index your category pages using the Yoast SEO plugin?
Intermediate & Advanced SEO | | webestate0 -
Redirection Effects on Sub Domain
Hi, I would try to summarize my query through an example. Lets say site A (www.siteA.com) have two sub domain (subdomain1.siteA.com & subdomain2.siteA.com) and another site B ( www.siteB.com ) have no sub domain. Due to some obvious reason we need re direct the site site A (www.siteA.com) to site B ( www.siteB.com ) and one of the sub domain (subdomain1.siteA.com) to site B (subdomain1.siteB.com). Now the question is that in case of ( subdomain2.siteA.com ) can we keep the sub domain to site A even though site A has been re directed to site B ? Reasons for keeping this can be traffic, earnings etc. Is it possible to keep it like that or provision for further optimization? Plz help.
Intermediate & Advanced SEO | | ITRIX0 -
How do i redirect www.domain.com/ to www.domain.com/index.php
I keep getting in my analytics www.domain.com/ and www.domain.com/index.php how do i make it consistently redirect to one version and not to both. I know about htaccess redirect and am already using this so am puzzle to which is the best one to use. below is the example .htaccess file im using. Options +FollowSymlinks
Intermediate & Advanced SEO | | mattmillen
RewriteEngine on
rewritecond %{http_host} ^domain.co.uk [nc]
rewriterule ^(.*)$ http://www.domain.co.uk/index.php$1 [r=301,nc] which is better for SEO should i forward to www.domain.com/ or www.domain.com/index.php0