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
-
Snippet showing as domain name with apostrophe, instead of page title when searching for the domain name.
Hi, We have an issue with one of our websites, with the snippet dispaying differently in Google serps when searching for the domain or the website name rather than a search term. When searching for a search term, the page title shows as expected, but when searching for the site by the domain name either with or without the tld, it shows the snippet as the domain name with an apostrophe at the end. Domain is subli.co.uk Thanks in advance for any advice!
On-Page Optimization | | K3v1n0 -
.htaccess redirect chains
At item 4 in the post at http://moz.com/blog/htaccess-file-snippets-for-seos the author recommends combining .htaccess redirects to avoid chaining redirects. I'd be obliged if someone could expand on: 1. What he means by chained redirects 2. How to combine the redirects per his recommendation Cheers.
On-Page Optimization | | ztalk1120 -
Blocking Subdomain from Google Crawl and Index
Hey everybody, how is it going? I have a simple question, that i need answered. I have a main domain, lets call it domain.com. Recently our company will launch a series of promotions for which we will use cname subdomains, i.e try.domain.com, or buy.domain.com. They will serve a commercial objective, nothing more. What is the best way to block such domains from being indexed in Google, also from counting as a subdomain from the domain.com. Robots.txt, No-follow, etc? Hope to hear from you, Best Regards,
On-Page Optimization | | JesusD3 -
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 -
State Abbreviations and/or Fully Spelled Out?
Should State names be abbreviated and/or fully spelled out in title tags, meta descriptions and body content? Does Google know that VT = Vermont?
On-Page Optimization | | lbohen0 -
.us VS .com
In general from what I have experienced a location specific extension such as .co.uk geo-targeted to the same location gives the best results when ranking BUT when I look at results from the US, page after page shows results of .com, surely if my above statement is true then a .us domain extension should rank better then a .com.
On-Page Optimization | | activitysuper0 -
Duplicate page content & title for www.mydomain.com and www.mydomain.com/index.php?
Hi, First post so please be gentle! My Crawl Diagnostics Summary is showing an error relating to duplicate page content and duplicate page title for www.mydomain.com and www.mydomain.com/index.php which are, in my view, the same thing/page? Could anyone shed any light please? Thanks Carl
On-Page Optimization | | Carl2870 -
WordPress (.com) and SEO
I am in my 30 day trial and very interested in my results. I think I am probably in a small minority in having the same web site up and running for approaching 17 years (registered in January 1995 :)) but only now am I looking at SEO seriously (to the extent that I want to learn more myself, as opposed to having others promise great fortune!)). Anyway, before committing to SEOMoz on an ongoing basis I want to understand just how actionable the information on my dashboard is. With that in mind, here's the first of what is (hopefully) a series questions that about low-hanging fruit I might be able to check off quickly. I recently brought up a new blog on WordPress.com (note - hosted by WordPress, not a self-hosted implementation). I have had this blog running for less than a month and have just 18 posts. And I am being overwhelmed with thoudands of errors/warnings from SEOMoz. These fall into a few categories: Duplicate content: As I understand it, each TAG I associate with a single blog post creates a unique URL. For example, if I have a single post with tags for "flowers", "wine" and "cakes", I get URLs generated such as <blog url="">/flowers, <blog url="">/wines and <blog url="">/cakes. Obviously, tagging posts is a common scenario. Must I just accept these duplicate content warnings?</blog></blog></blog> Title element too long: These are self generated by WordPress.com and the default format includes the date the post was submitted (which takes a bunch of characters followed by the title used). Many of the posts are well over 70 and this seems really easy to do. Missing meta-description: As far as I can tell, Wordpress.com doesn't give me an option to specify these. So, must I just accept these issues if I use WordPress.com (which, again, seems like a very common scenario) and how negative is this to me? Thanks. Mark
On-Page Optimization | | MarkWill0