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
-
We recently updated a large guide that takes the place of the original. The original has some nice organic traffic to it and I don't want to risk losing it. Should I 301 redirect to the new version, or update all the info directly on the original page?
We don't have a lot of content that garners much non-branded organic, so this is something I don't want to risk losing. We do not have a whole lot of external links into the page either.
On-Page Optimization | | AFP_Digital1 -
Redirect question
Hi Everyone I've tried searching elsewhere in these forums for an answer to this but not having much luck - hope I'm not duplicating content! I get this message in Moz: "We have detected that the domain NappyValleyNet.com redirects to www.nappyvalleynet.com. We do not recommend tracking a redirect URL. Would you like to track www.nappyvalleynet.com for this campaign instead?" Is this a set-up issue on my side? I'm not sure what this means? Thank you!
On-Page Optimization | | NappyValleyNet0 -
I am trying to better understand solving the duplicate content issues highlighted in your recent crawl report of our site - www.thehomesites.com.
Below are some of the urls highlighted as having duplicate content -
On-Page Optimization | | urahul
http://www.thehomesites.com/zip_details/76105
http://www.thehomesites.com/zip_details/44135
http://www.thehomesites.com/zip_details/75227
http://www.thehomesites.com/zip_details/94501 These are neighborhood reports generated for 4 different zip codes. We use a standard template to create these reports. What are some of the steps we can take to avoid these pages being categorized as duplicate content?0 -
Agency Domain Authority Boosting Activity
Hi Guys Have been reading up a bit on methods for boosting Domain Authority and am generally finding that the best way is by producing unique and relevant content through blogs and other kinds of articles. Having multiple clients in an agency means that there is limited time for this and I need something else to assist in boosting Domain Authority. I perform a fair bit of backlinking through online directories, however I am also finding that most blog comment sections have implemented 'no follow' codes to reduce spam content. There are plenty of free online directories, and many with high Domain Authorities, however they can take up to months for the listings to be approved. I am performing other activities to boost keyword rankings in Google for our clients but need some help with getting their Domain Authority up. Does anyone know of an efficient method for boosting Domain Authority for an agency with many clients where blog writing for each may not be a viable option? Would be great to hear anyone's ideas!
On-Page Optimization | | JuiceBoxOM0 -
Google Index Report
Hi, I have just checked my google webmaster tools account and viewed the index status of my website and it produced the attached graph, which show quite a big spike in indexing during July and August 2012. Does this look normal or does it reveal anything peculiar? We did have a new website launched in June 2012 and I re-submitted the sites URL's to google as part of the re-launch and so I am unsure if this may account for the spike. Any advice appreciated. Thanks indexing.png
On-Page Optimization | | UnderMe0 -
302 Temporary Redirects
Hi, We currently have a number of 302 redirects set up on our e-commerce store that redirect from no forward slash at the end to a forward slash at the end of the url (see below). example: domain.com/treadmills
On-Page Optimization | | DustyBraband
Redirects to
domain.com/treadmills/ Am I correct in saying that this will not pass link juice and the redirects should be changed to 301's (or just removed?). Or are the two urls treated the same (with or without forward slash)? Thanks in advance! Regards,
Dusty0 -
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 -
Setting up a domain for a future site
Hi there, That may be a bit of a silly question to ask, but we've setup a new domain for an existing site. While the site is in the making, the site owners wants to already start promoting the new URL on stationeries etc. Hence, we need to setup the new URL so that it forwards to the site, but so that Google doesn't give it the history of a secondary (less important) domain. What is the best way to do this? Currently we've put in a 301 redirect, but will that bear no future consequences on the SEO of the site, when the site is moved to this new domain, and the old domain is 301 redirected. Thanks, SEOeclipse
On-Page Optimization | | Bozboz0