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
-
No index vs removal - Subdomains
One of my clients has a subdomain - docushare.***.edu (vs ***.edu) that they would like to not influence SEO.
On-Page Optimization | | Crescent_Sense
the question is: should they no -index these pages or remove as a subdomain? Thank You! jeremy0 -
News site and duplicate/cannibalism/old
Hey everybody. I am working with a handful of medical news websites and some of these sites are rather large. I am noticing/suspecting there is some cannibalism going on here. How do news sites deal with this? Do they noindex the old stuff? Update the old stuff instead of writing a new piece all together? Curious what to do!
On-Page Optimization | | HashtagHustler0 -
Blog Site Set-Up/Frequency
Hello! I am a new blogger that is just getting started. All I have done so far is purchase a domain name and signed up with Blue Host. From what I am reading, WordPress seems to be the most recommended plug-in to get going. There is a lot of material out there on SEO and I wanted the community's thoughts on where to start. My blog is intended to provide readers with information on a particular topic. It is a vast area with much to write about - I intend on populating the content myself/with the help of experts in the field. It is not news so it is not time sensitive. Here are my questions: 1. As this is a brand new site, should I be blogging every day or is couple of times a week sufficient? I am able to produce content fairly quickly in the beginning as there is a lot to write about. Should I write a whole lot of content first and then release it on a schedule (twice a week, daily, etc.)? As it is a new site, I don't want it to launch with just one article.. 2. I am taking a WordPress class next week, but as someone that is not too familiar with copy/backlinks, other mechanisms to boost SEO. does WordPress make it easy enough to optimize your site for search results or does it require more expertise? As far as I see, my first tasks are to 1. ) set up the site effectively so people can find it and 2.) create valuable/engaging content. Appreciate any advice on setting up the site, blogging frequency, other tips to get going. I don't want to launch a site and get dinged by Google for reasons I am unware of..At some point, when I have a robust set of content, I am thinking of FB advertising to increase traffic to the site. Seems a bit premature to do that at this point.. Thanks all in advance for your feedback!
On-Page Optimization | | mmprakash0 -
Disappearing and reappearing in google index
Hello. I made a lot of car accident lawyer city pages. They probably weren't as unique as they should have been. Suddenly, they all disappeared from the rankings and I freaked out. Then, two days later, they all returned. Is this a bad sign? Should I be worried? Why would they drop out of the rankings and come back in? Let me know, thanks.
On-Page Optimization | | RafeTLouis0 -
Www and non-www
I have a site that has used both www and non-www urls since inception years ago. Moz is saying that I have 183 pages of duplicate content, and it is all because each internal link has both versions. Both versions have high PR and links going back to them...should I still 301 redirect to one of them or should I leave them be? Thanks Brad
On-Page Optimization | | bradleymiller1480 -
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 -
302 (Temporary Redirect) up and growing, how to fix?
Hi guys. On my website I have an action that will only perform if you are logged into your account, otherwise you are redirected to the login page causing a 302 redirection. When SEOmoz crawls my website, it gets all these redirections to the login page, but I really can't do much better so what is the best way of fixing this? I've thought of using rel="nofollow", but I want make sure this change will fix my issue, both with the SEOmoz crawler and any other search engine crawler. Thank you guys so much!
On-Page Optimization | | tanlup0 -
ON SITE SEARCH INDEXED BY GOOGLE - no follow or no index
Google indexes alll our internetal searches: search box is brand - clothes types - size type - and for each page it creates a page that which creates duplicate page title and unnecessary content. Should I do a nofollow on the advance search or a no index. Many thanks for the info. Sonja
On-Page Optimization | | reallyitsme0