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]
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
-
Index Bloat: Canonicalize, Redirect or Delete URLs?
I was doing some simple on-page recommendations for a client and realized that they have a bit of a website bloat problem. They are an ecommerce shoe store and for one product, there could be 10+ URLs. For example, this is what ONE product looks like: example.com/products/shoename-color1 example.com/products/shoename-color2 example.com/collections/style/products/shoename-color1 example.com/collections/style/products/shoename-color2 example.com/collections/adifferentstyle/products/shoename-color1 example.com/collections/adifferentstyle/products/shoename-color2 example.com/collections/shop-latest-styles/products/shoename-color1 example.com/collections/shop-latest-styles/products/shoename-color2 example.com/collections/all/products/shoename-color1 example.com/collections/all/products/shoename-color2 ...and so on... all for the same shoe. They have about 20-30 shoes altogether, and some come in 4-5 colors. This has caused some major bloat on their site and I assume some confusion for the search engine. That said, I'm trying to figure out what the best way to tackle this is from an SEO perspective. Here's where I've gotten to so far: Is it better to canonicalize all URLs, referencing back to one "main" one, delete all bloat pages re-link everything to the main one(s), or 301 redirect the bloat URLs back to the "main" one(s)? Or is there another option that I haven't considered? Thanks!
Intermediate & Advanced SEO | | AJTSEO0 -
Redirect Chain Advice
Hi, i hope you can help. My site crawl is showing that I have a redirect chain on my home page. Basically it shows I am going from : http: > https: > https://www. I need everything to go from http:// and http://www directly to https://www. without the chain. Below is a copy of the htaccess, can anyone see if there is an error in there that could be causing it. RewriteEngine On
Intermediate & Advanced SEO | | DaleZon
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] BEGIN WordPress <ifmodule mod_rewrite.c="">RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]</ifmodule> END WordPress In addition, i have seen that they have a plugin called SSL insecure content fixer installed. It is showing this under its status: Array ( [HTTPS] => on [PHPHANDLER] => /usr/local/php70/bin/php [HTTP_X_REAL_IP] => 109.158.20.158 [HTTP_X_FORWARDED_PROTO] => https ) I think possibly this might have something to do with the issue, any thoughts are appreciated Thanks0 -
Preserve domain on 301 redirect?
We have a domain solely used for print advertising that does a 301 redirect to a landing page (a department home page) on our "real" domain that is indexed on Google. Example: www.bmwrepairs.com redirects to www.repairshop.com/bmwrepairs. Is there a way to do a 301 redirect so that when they get redirected, the URL in the browser address bar remains www.bmwrepairs.com?
Intermediate & Advanced SEO | | Jazee1 -
How can i stop such links being indexed
Hi, How can i stop such links being indexed The first link is what i want to stop indexed. We have 1,000's of people writing articles and the below URl shows how many articles each did http://www.somename.com/article/15633 But this is the URl which shows the exact articlehttp://www.Somename.com/article/step-step-installation-ibm-lotus-notesAs both start as thishttp://www.Somename.com/article/How can i set noindex? Should we set for each URL manually one by oneThanks
Intermediate & Advanced SEO | | mtthompsons0 -
Is this link being indexed?
link text Deadline: Monday, Sep 30, 2013 link text I appreciate the help guys!
Intermediate & Advanced SEO | | jameswalkerson0 -
Automatic redirect to external urls
Hi, there is a way to create a "bridge page" with automatic url redirect ( 302 ) without google penalization? In this moment, my bridge pages are indexed on google with title and description of the redirected page.. Thanks in advance. Mauro.
Intermediate & Advanced SEO | | raulo790 -
Is Google mad at me for redirecting...?
Hi, I have an e-commerce website that sells unique items (one of a kind). We have hundreds of items and the items are rapidly sold. Up till now I kept the sold items under our "sold items" section but it started to get back at me as we have more "sold" than non sold and we are having duplication problems (the items are quite similar besides to sizes etc.). What should we do? Should we redirect 100 pages each week? Will Google be upset with that? (for driving it crazy) Thanks
Intermediate & Advanced SEO | | BeytzNet0 -
Static index page or not?
Are there any advantages of dis-advantages to running a static homepage as opposed to a blog style homepage. I have be running a static page on my site with the latest posts displayed as links after the homepage content. I would like to remove the static page and move to a more visually appealing homepage that includes graphics for each post and the posts droppping down the page like normal blogs do. How will this effect my site if I move from a static page to a more dynamic blog style page layout? Could I still hold the spot I currently rank for with the optimized index content if I turn to a more traditional blog format? cheers,
Intermediate & Advanced SEO | | NoCoGuru0