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
-
SEO and auto login with redirect
Hi, we have a site where user we know (cookie-based) is automatic redirected to private internal page. Unknown guests are staying on the page google search sent them. The redirect is done with a 302 to the private page. When I examine organic search and landing pages in analytics I see that more than 50% of the landing pages are private pages (inaccessible for the google-bot). This is because analytics does not register the redirecting page, just the target page. Is this harmful to SEO that so many users are redirected to other pages, or is this data not available to google-bot. The google bots is not redirect since they do not have the correct credentials. Do chrome or analytics send such data back to Google search? Is better to manipulate analytics page track call to use the address of the redirecting page? Or maybe skip to redirect, and just render the private content on the orginal page?
On-Page Optimization | | Morten.Berg0 -
Use cookie-free domains
Is there anything simple i can install to reduce the Use of cookie-free domains, i have tried to used fooman extension but had major conflicts with other extensions? Kind regards
On-Page Optimization | | Mikaai0 -
I noticed that my company owns a few exact match domains that are relevant to our business. Is it worth doing anything other than just redirecting them to our homepage?
It turns out we own a few exact match domains that are relevant to our business. Is it worth doing anything other than just redirecting? (We have owned these sites for a long time, over 15 years.) The keywords are moderate to low in traffic and moderate to high in competitiveness. (Right now they 301 to our main site.) I know exact match is not as valuable as it used to be and that there are mixed opinions about microsites...
On-Page Optimization | | Linda-Vassily0 -
Should sub domain blog have www or non www
My main site has htaccess rewrite condition to force www. I just added a blog on sub domain and have it www.blog.domain.com Is this setup correctly or should it be http://blog.domain.com or does it make a difference? A colleague just pointed that out and said it should be non www for blog or any sub domains. Thanks for any clarification.
On-Page Optimization | | anthonytjm0 -
Duplicate content with a trailing slash /
Hi, I 've pages like this: A) www.example.com/file/ B) www.example.com/file Just two questions: Does Google see this as duplicate content? Best to 301 redirect B to A? Many thanks Richard PS I read previous threads re the subject, it sounded like there was a bug in SEOMoz but I was not absolutely clear. Apologies if this is going over old ground.
On-Page Optimization | | Richard5550 -
Building content pages, redirecting and linking
Previously the company had created some .HTML content pages around top shoe styles and top manufactures. One or two of these pages used to rank but have been neglected over the page 18 months. I want to build out new content round our top styles / top manufactures and I am wondering if I should use the existing HTML pages or create new pages that use our content management system. The .HTML pages can contain keywords in the URL, using our content management system, all URL’s are www.site.com/content/home/contentid=1234abcd. If we use the .HTML pages all content is managed manually. If we build out 6 to 10 pages, this can become a resource issue and may result in a bad experience for the website visitor. From an SEO perspective, does the benefit of having the keywords in the URL outweigh the manual management hassles? And if not, should we 301 all the HTML pages to the new content pages? And from a linking standpoint, I want these content pages to point to the new version of the top style. From a navigation standpoint, we also want to provide access to all styles from the manufacture. Should we nofollow the links to all styles?
On-Page Optimization | | seorunner0 -
Redirect and page ranking
We used to have a good page rank of Google, but now our page rank dropped to zero. A few months ago we did a redirect from our www.???.com to non-www.???.com, because non-www.???.com is now our main website. We also have a number of other domains which we redirect to our main website non-www.???.com Do you think these redirects are causing the problem, and if so what can we do to fix it? Thanks!
On-Page Optimization | | poupette0 -
Cross Domain Duplicate Content
Hi My client has a series of websies, one main website and several mini websites, articles are created and published daily and weekly, one will go on a the main website and the others on one, two, or three of the mini sites. To combat duplication, i only ever allow one article to be indexed (apply noindex to articles that i don't wanted indexed by google, so, if 3 sites have same article, 2 sites will have noindex tag added to head). I am not completely sure if this is ok, and whether there are any negative affects, apart from the articles tagged as noindex not being indexed. Are there any obvious issues? I am aware of the canonical link rel tag, and know that this can be used on the same domain, but can it be used cross domain, in place of the noindex tag? If so, is it exactly the same in structure as the 'same domain' canonical link rel tag? Thanks Matt
On-Page Optimization | | mattys0