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
-
Domain Redirection
hi all - question we seem to see people ranking better naturally when they have the seo term in their title. Say we were optimising for "red buses". Our company was called Diamond we are using Diamond.co and have a DA of 32 (Page Title Diamond Red Buses | Bla) Should we buy diamondredbuses.co.uk ? Is it best to continue on our domain and redirect? Or move domains? How much would it affect?
On-Page Optimization | | KellyDSD860 -
What is the best use of canonical ref on home (default/index) page?
Moz reports show duplicate content for my www.domain.com and www.domain.com/default.html How do I format the canonical ref to put on the default.html page?
On-Page Optimization | | bhsiao0 -
Pages indexed but not seen in wordpress
Hi there, the crawler of SEOMOZ has detected that some pages have no title or a short metadescription. The problem is that I can't see these pages in wordpress (in the backend). These pages are irrelevant and must be deleted but I can't find them. How could they be indexed by the Googlebot? Where can I find them? Any hint? Thanks all.
On-Page Optimization | | juanmiguelcr0 -
Prevent Indexing of URLs Based on Tags
I started my website as a blog over at Posterous, but decided to turn it into a full scale business website with a self-hosted WordPress theme. Shortly after transitioning from Posterous to WordPress, I noticed that Google was indexing not only my old blog posts, but the URLs of my blog posts based on the tags they have. Is there any reason why this is a problem? I'm sure it shouldn't qualify as duplicate content, but for some reason it just feels a bit sloppy to me to have all of these pages indexed...Is this a non-issue? Should I just be more discriminating with my use of 'tags' if it bothers me? JiGLH.png
On-Page Optimization | | williammarlow0 -
Www.sitename.com or sitename.com?
A client of mine's site is currently sitename.com. www.sitename.com redirects to the non-www URL and the canonical is using the non-www URL. This is a fairly new site and there aren't many existing inbound links. Is there a benefit to switching this?
On-Page Optimization | | BostonWright0 -
301 redirects from several sub-pages to one sub-page
Hi! I have 14 sub-pages i deleted earlier today. But ofcourse Google can still find them, and gives everyone that gives them a go a 404 error. I have come to the understading that this wil hurt the rest of my site, at least as long as Google have them indexed. These sub-pages lies in 3 different folders, and i want to redirect them to a sub-page in a folder number 4. I have already an htaccess file, but i just simply cant get it to work! It is the same file as i use for redirecting trafic from mydomain.no to www.mydomain.no, and i have tried every kind of variation i can think of with the sub-pages. Has anyone perhaps had the same problem before, or for any other reason has the solution, and can help me with how to compose the htaccess file? 🙂 You have to excuse me if i'm using the wrong terms, missing something i should have seen under water while wearing a blindfold, or i am misspelling anything. I am neither very experienced with anything surrounding seo or anything else that has with internet to do, nor am i from an englishspeaking country. Hope someone here can light up my path 🙂 Thats at least something you can say in norwegian...
On-Page Optimization | | MarieA1 -
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 -
Necessary to redirect non-www to www?
Hello All, I've read quite a bit on here and the Matt Cutts blog http://mattcutts.com/blog/seo-advice-url-canonicalization/ about non-www vs www. I''ve also read a few recent posts on here but still left a little confused. First, my site is PR 4. We don't have many links, but the ones we do have (including internal) point to the www.example.com. You can also get to our site by typing example.com and it will not switch to the www. version. Both versions have the PR4, I just want to make sure I'm not losing any PR or juice between the different versions. My question, would you advise 301 redirect to the www version? if so, I have Godaddy as our host, is it as simple as going into the hosting control and doing the redirect there?
On-Page Optimization | | someoneguy0