301 redirect (www.domain.com/index to www.domain.com)
-
Hello,
Please let me know what are the exact right steps in order to get rid of the duplicate content issues related with:
www.domain.com/index.html same as www.domain.com without creating an infinite loop.
Do you have a step by step guide posted within seomoz including 301 redirect for non www to www for all urls and index.whatever to main domain name without going into a infinite loop ?
btw how to you spot the loop ? is it obvious like never ending refresh of the home page ?
thanks a lot !
-
Well, I would recommend you alter the internal links to just point to the new '/' default, but in the meantime...
I would have thought your code would have worked, but every time I try it my site falls over. It might work for you though. Give it a try but test it straight away
I'll see if I can get a different version working on my test site for you if not
-
seomoz tool is showing duplicate pages for those 3. Each of the version has at least 1 internal and even external links.
all 3 respond in the browser with the same layout/page
-
Hmm, maybe, I doubt the index.php is doing anything as if there's a index.html and index.php the .html takes precedence.
Check what's in the .php file, might be easier just to delete it.
-
Can I use a code like this ? (i've added one entry for index.php as it looks like the site has both an index.html and an index.php)
Barry Smith
Journeyman264 mozpoints
6 helpful answers
1 SEOmoz endorsed answers| Helpful Answer | Barry Smith, Head of SEO at Gaming Media Marketing | about 2 hours ago |
Probably the simplest way to redirect the non-www to the www is to put this in your .htaccess file
RewriteEngine On Options +FollowSymLinks
RewriteCond %{HTTP_HOST} ^example.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]RewriteCond %{THE_REQUEST} ^./index.html
RewriteRule ^(.)index.html$ http://www.example.com/$1 [R=301,L]RewriteCond %{THE_REQUEST} ^./index.php
RewriteRule ^(.)index.php$ http://www.example.com/$1 [R=301,L] -
Thanks mate !
More then helpful.
-
Yeah, if it doesn't work you'll probably be faced with a blank page or you may get a 500 server error or maybe a 310. It should be obvious pretty fast
-
how it will behave if the redirect is not correct ? It will be visible ? (like a never-ending refresh of the main page)
-
I agree with Barry, but watch out for that last snippet. I've got caught when hosting companies redirect on their side. So test before walking away for more coffee : )
-
The last part redirects index.html to /
There would only be a loop if you redirected / to index.html
99.9% sure this'll work for you I'm using the exact code on a small site right now and it's working fine
-
is the last part safe ? as far as the infinite loop things that some are afraid of..
-
Probably the simplest way to redirect the non-www to the www is to put this in your .htaccess file
RewriteEngine On Options +FollowSymLinks
RewriteCond %{HTTP_HOST} ^example.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]RewriteCond %{THE_REQUEST} ^./index.html
RewriteRule ^(.)index.html$ http://www.example.com/$1 [R=301,L]For reference the .htaccess file goes in the root of your domain via whatever file transfer program you use and of course replace example.com with your domain
If you get stuck, let me know
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
-
How do I redirect SEO from pages on old website to new website with new domain name?
How do I redirect SEO from pages on old website to new website with new domain name? My website in squarespace has good rankings and we have rebranded to a new name and enw domain name, how do I move across the rankings fomr the old site in squarespace to my new site thats in wordpress please?
On-Page Optimization | | Carrotpower0 -
Internal links are not indexed of the website
Some internal links are indexed and some not of the same page of the website, what is the so and what is the reason behind?
On-Page Optimization | | renukishor10 -
Blocking Subdomain from Google Crawl and Index
Hey everybody, how is it going? I have a simple question, that i need answered. I have a main domain, lets call it domain.com. Recently our company will launch a series of promotions for which we will use cname subdomains, i.e try.domain.com, or buy.domain.com. They will serve a commercial objective, nothing more. What is the best way to block such domains from being indexed in Google, also from counting as a subdomain from the domain.com. Robots.txt, No-follow, etc? Hope to hear from you, Best Regards,
On-Page Optimization | | JesusD3 -
Left Nav / SEO
We are in the middle of a redesign and would love to get rid of our left navigation. It's currently full of SEO rich categories and has been the same for 10+ years. Our programmers think removing the left navigation will have no impact on our SEO. As SEO's, do you agree with this?
On-Page Optimization | | EileenCleary0 -
What is a better mobile domain from an SEO perspective an m.example.com or using your regular domain with user agent detection?
Just wondering what domain is more beneficial for a mobile site and why.
On-Page Optimization | | CabbageTree0 -
Multi-language on multiple domain
Hi, One of my clients has a big duplicate content issue on his site. He has two domain, on for each language (FR and EN) but each domain propose the two languages! Meaning you can reach every page with two URL. Example: http://www.brand-realestate.com/en/luxury/index.html (home page of the default site in english)
On-Page Optimization | | Pherogab
http://www.immobilier-brand.com/en/luxury/index.html (home page of the default site in french after clicking on the english link) Each of the two site has a default language and a link to the other one. When you click the link the page you are on just refresh and the URL stay the same with an added language parameter (ie:http://www.immobilier-brand.com/luxe/index.html?lang=english), then all the link in the navigation switch to the other language. So my question is, is it better to: Keep the two domain and instead of having the two languages on each send the traffic to the domain which has the targeted language by default (on the right page of course) Have both language on one domain and redirect all the pages from the other domain to this one (each page to the corresponding one) Just add a canonical URL on each alternative version of each domain Let me know if I'm clear. Thanks for the help. GaB0 -
Negatives to using custom sub domain?
So - being photographers, we have our main website, but also, we use a hosted service for all our client galleries (www.zenfolio.com) So, in effect, we have two websites: Our main informational website Our client gallery/proofing website The client gallery has back links to our main website - so, when people are viewing their gallery, they can easily get back to our main site. We also have thrown a few of our preferred keywords in there for SEO purposes. The gallery has thousands of pages which link back to the main site. So.. the client gallery URL can either be: http://ourbusinessname.zenfolio.com OR we can have it so it uses our own domain, such as: http://gallery.ourbusinessname.com The question is, which domain name will benefit the back links more? Our custom subdomain (which links to our main domain) or, using the Zenfolio domain (which is external to our site). Or, is there no real difference either way? Or.. do I make no sense?
On-Page Optimization | | blitzna100 -
301 Re-directing a page
Hi, My website is appearing on page 1 of Google for a specific keyword, however when clicking on the search result, the page is out of date. As a short term solution, I have 301 redirected the url to a more up to date page on my website and beginning to optimise the on page content of this new page Is there any recommendations on what to do with the old page that appears on page 1 Google - as the page title, meta description and url displayed is out of date? Any help, best practise would be great...
On-Page Optimization | | simonsw0