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
-
One question about the domain choice.
Hi guys, I'm an Italian Web marketing and I'm studying SEO since some moths. First, sorry for my bad english.... 🙂 Second, the question: My Italian blog is going really GREAT in terms of popularity and incomes and know I want to bring it in english language with the help of a professional translator. The choice that I have to take is about the future domain of the english blog. My Italian blog has as url mynameandmysurname.net I don't really like to make the english blog appears like myitalianblogurl.net/english because I think it's a little bit confusing and not professional. I have also thought the idea to make a sub domain like blog.myitalianurl.net. What about the WPML plugin? Do you think it's a great choice? I don't like it because it's confusing and it affect my italian blog. Or maybe is it better to create a new branded blog with different domain? It can be an idea but I think that If I chose this way I will lose all my seo efforts of the last years 😄
On-Page Optimization | | Italianseolover0 -
Google indexing
Hi In my site I have 2 blogs, the first blog is a standard blog, every post is informative and over 6oo words with pictures and all of them are keyworded. The second blog is basically a journal of bike rides i go on, with a picture and about 100 - 300 word writeup. I use a portfolio plugin to get this online. My question is should I noindex nofollow all of these posts. Im not sure if google will see it as a lot of uninformative noncene, I dont write these as blog posts they are a journal I post 1 or 2 a day. What is the normal practice for this... they are not keyworded or seo'd I dont want them to affect my seo or rankings. Thanks Chris
On-Page Optimization | | mrcsleonard0 -
Redirection
Hi all I have these domains active:
On-Page Optimization | | juanmiguelcr
www.piensapiensa.es
http://piensapiensa.es which redirects to www.piensapiensa.es via webmastertools
http://piensapiensa.com
www.piensapiensa.com which redirects to http://piensapiensa.com via webmastertools.
I want the last three items to redirect to www.piensapiensa.es Here is part of the code of the htaccess file that I have until now:
Options +FollowSymLinks +ExecCGI
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.piensapiensa.es [NC]
RewriteRule (.*) http://www.piensapiensa.es/$1 [R=301,L] Thanks in advanced.0 -
Multiple Years Domain Registration
Is there benefit to registering a domain name for multiple years from a SEO standpoint?
On-Page Optimization | | lbohen0 -
Temporary Redirect
I am having lot of Temporary Redirect on my reports, and all the links points to my ads server (openX). like this: http://ads.espectador.com/mod2/www/delivery/ck.php?n=a04fb31e&cb=138097 Here in this page there is an example.- How can I fix this? Thanks
On-Page Optimization | | informatica8100 -
I built a website on magentogo - IrisScottPrints.com. The seomoz crawl report states 301 rel canonical crawl notices. What if anything should I change?
Wondering if I should remove "IRIS SCOTT PRINTS |" from all the title tags and/or change the url structure of the pages, to not include the breadcrumbs... I don't really understand the whole rel canonical structure thing. Also lots of errors on page title too long - does that really matter? Lots of faith in everyone here. Thanks in advance. Marcia
On-Page Optimization | | RedTrout0 -
Time taken for inclusion in index
After a page is crawled, how much time does it take to be included in Google's index ? Immediately ? after few days ?
On-Page Optimization | | seoug_20050