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
-
Is it a good practice to reduce number of redirections (301) after a period of time?
Is it good to use disavow tool and get rid of old URLs i.e. links for pages and posts which we have deleted from our website and added 301 on them?
On-Page Optimization | | Ravi_Rana0 -
Domain authority decreased but rankings increased
Hello! I'm a bit confused. It seems the industry as a whole that my company operates in has taken a bash from the update a few days ago as all of the competitiors have taken a hit to their domain authority. What is confusing is that my websites rankings have increased as well. There has been a change to the robots.txt file in an effort to stop being crawled by SEMRush which is messing with my site stats but that is the only change. Thanks in advance, Ben
On-Page Optimization | | Ben-Cleaver1 -
Should old pages that have being 301 redirected but have no/mimimal traffic be deleted?
In other words, I have pages from years ago that are redirected but how can I tell if traffic still flows through them? And if there is no or minimal traffic should the 301 be deleted? Linck
On-Page Optimization | | LinckB0 -
Google indexing page differently
Does google index an interal page differently depending on whether you are using a FULL url (including domain) or just a relative link? Also, is it possible that using a full URL (http://mysite.com/page.html) causes the browser to "ping" the server differently than just having the href linked to using relative links (/page.html) Could this cause server or firewall perfomance issues?
On-Page Optimization | | WebRiverGroup0 -
Multiple Years Domain Registration
Is there benefit to registering a domain name for multiple years from a SEO standpoint?
On-Page Optimization | | lbohen0 -
Keyword domains
Hello, I am the proprietor of RacquetSource.com, Is there any merit to using keyword domains and have them redirect to the site, or a specific page on the site? For Example, the keyword term, Squash Racquets, if I were to purchase a domain name, squash-racquets.com and have it redirect to http://www.racquetsource.com/squash-racquets-s/95.htm will this effect positively to my search ranking of the keyword term Squash Racquets? Any insight would be greatly appreciated. Cheers Geoff
On-Page Optimization | | GeoffBatterham0 -
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 -
Domain Extension
I am creating a website in canada to target a specific region in my city and was wondering if i should USE a .com, .ca, .org or a .info extension? i can purchaes all, but which should be used? I noticed some other websites have .org or .info instead of .com.....what is the preferred extension for Google?
On-Page Optimization | | Souk0