Canonicalization and 301 redirects

February 1st, 2007

So what is a Canonicalization Problem?

These days, I’m finding alot of sites with dual listings in google – for example, if I’m, people have linked (or I have linked to myself) as Google has picked that up, and assumed you are running two different websites. As such, if you search for your site by typing ‘’ and ‘‘, you’ll get results for both.

Canonicalization / Canonicalisation – and why it’s not good.

This problem is called a canononicalization problem, and is not a good thing because:-

  1. It dilutes your pagerank – inlinks to your site are spread across both sites for the purposes of PR calculation.
  2. It dilutes your pagerank – not all your pages are actually indexed together – therefore, your total potential pagerank is lower.
  3. It dilutes your pagerank – google sees non-www and www versions as seperate, and thinks that one site has copied content off the other – this can cause a large number of supplementals, and potentially decreased PR.

Getting the picture?

The Solution? 301 redirect!

This problem can be fixed using what’s called a 301 Redirect.

This all sounds complex, but it’s not – let’s demystify it – a 301 Redirect simply tells Google that the page has moved permanently to another URL.

In our case, we want to tell google that it should always look for the non-www version of our site at the www url (or vice-versa).

How do I use 301 redirects to fix canonicalization problems?

Ok – well, I’m going to give you instructions about how to fix this problem, assuming you are on a linux server, you need to edit the .htaccess file in your webroot. In that file, you need to implement what is called a 301 redirect.

Here’s how:-

To implement a permanent 301 redirect from the www to non-www version:-

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^utheguru\.com
RewriteRule (.*)$1 [R=301, L]

To implement a permant 301 redirect from the non-www to www version:-

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^utheguru\.com [NC]
RewriteRule ^(.*)$$1 [L, R=301]

Obviously, you need to change UtheGuru to your own domain!

Hope this help a few people!



Entry Filed under: SEO Discussions

If you found this page useful, consider linking to it.
Simply copy and paste the code below into your web site (Ctrl+C to copy)
It will look like this: Canonicalization and 301 redirects

15 Comments Add your own

  • 1. JLH  |  February 7th, 2007 at 10:30 am

    For those on using .asp, I’ve got a cool little script that works on pages that parse the asp code.

  • 2. DuckMan  |  February 7th, 2007 at 10:39 am

    Thanks for that JLH (for those of you that don’t know, JLH is one of the gurus that hangs around Matt Cutt’s Blog and the Google Webmasters Forum) – I’m hopeless at windows servers so I wouldn’t have the foggiest about what to do there.. Me likes linux.

    And good to see you still know where to come to build quality backlinksmate ;p

  • 3. JLH  |  February 7th, 2007 at 3:40 pm

    Good quality nofollow backlinks which is great if you’re targeting that 3% of the search market that yahoo and MSN provide!

    All my Linux stuff is wordpress blogs, in which case I just use the enforce-www plugin. at

    I know I’m a good linking neighborhood as Matt linked to me this week and he’s not shy about using the nofollow for bad neighborhoods.

  • 4. JLH  |  February 8th, 2007 at 10:48 am

    I also add the lines:

    RewriteEngine on
    RewriteCond %{HTTP_HOST} .
    RewriteCond %{HTTP_HOST} !^www\.example\.com [NC]
    RewriteRule (.*)$1 [R=301,L]
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html\ HTTP/
    RewriteRule ^index\.html$ [R=301,L]

    to my .htaccss file that take care of trimming of the index.html portion.

    Actually I’ve got a generic version stored somewhere that looks up the domain for you so you don’t have to modify example everytime…now where did I put that???

  • 5. Sudiptojoel  |  February 22nd, 2007 at 4:29 am

    My site seems to have canonicalization problems , kindly help me out to veryfy it and resolve the issue

  • 6. Sudiptojoel  |  February 22nd, 2007 at 4:30 am

    My site seems to have canonicalization problems , kindly help me out to veryfy it and resolve the issue site link: click here

  • 7. DuckMan  |  February 26th, 2007 at 7:22 am

    How are you sudiptojoel – If you have specific problems, and want advice, we do offer personalized assistance, but this is a fee for service proposition – generally USD20 would be sufficient for such relatively minor problems.

    If you need further personal help, feel free to contact me above.


  • 8. &hellip  |  May 5th, 2007 at 8:04 pm

    […] interested. I do have to cite who presented the problem to me initially which is Doc’s site UtheGuru who I thank wholeheartedly for notifying […]

  • 9. Axle Ryde  |  July 17th, 2007 at 8:58 am

    I tried copying your code and the server threw a wobbly – it seems you have a missing piece of syntax in the non-www to www sample above?

    A separate example of this working had a backslash before the .com and is now working for me, so your RewriteCond line above should be:

    RewriteCond %{HTTP_HOST} ^utheguru\.com [NC]

    No idea why, but that’s what worked for me.

    Thanks for the pointers by the way – hopefully my client’s site will now get back to the high rankings it had before I came along! (skulks away . . .)

    Cheers –

  • 10. theDuck  |  July 17th, 2007 at 9:05 am

    Ah.. of course you are correct.

    In .htaccess a full stop (dot) is a reserved character, and the part of any mod rewrite that determines the match should have any full stops escaped with a back slash so that mod-rewrite knows to interpret the full stop literally.

    Cheers, and I’ve corrected the example above.

    On a side note – it’s pretty unlikely that canonicalization issues in themselves will cause a major decline in serps, at least not with Google, as Google is usually pretty savvy about ‘automagically’ detecting which canonical version of the URL is the one it should be working with.


  • 11. Trace  |  February 27th, 2008 at 2:12 pm

    All of your articles are well written, have great content and are extremely informative… thank you for putting these together, they are extremely helpful!

  • 12. steve  |  May 6th, 2008 at 7:09 am


    I have just put the redirect code in and literally 10 mins after doing it did a search for google for my domain and it lists it as index of/ with this underneath :

    Apache/2.0.63 (Unix) mod_ssl/2.0.63 OpenSSL/0.9.8b mod_auth_passthrough/2.1 mod_bwlimited/1.4

    Could doing this have caused Google to index it like this. Im not sure how long it has been listed like this

  • 13. usman  |  July 30th, 2008 at 3:47 pm

    I am using word press 2.5 does this needs canonicalization settings or this word press version comes fixed

  • 14. Anjali  |  January 21st, 2010 at 10:54 pm

    Your web site has 100 products and a site: query shows 50,000 URLs indexed.
    This mean canonicalization problem

  • 15. Monty Cook  |  February 12th, 2010 at 11:48 am

    I posted a question in Google Webmaster Forum about canonicalization. The only person who responded said that if I have a site that Google is indexing as non-www and set the preferred domain in Google Webmaster tools to www, and do the 301 re-direct that that I could have a drop in indexing or ranking (although probably temporary). Is this there a chance of this happening?

Leave a Comment


Required, hidden

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Trackback this post  |  Subscribe to the comments via RSS Feed

Featured Advertiser

Buy me a beer!

This sure is thirsty work - Here's your chance to buy me a beer :)



Posts by Month