If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!
Firstly let us look at a excerpt from Google Webmaster Central about a canonical url’s:
” If your site has identical or vastly similar content that’s accessible through multiple URLs, this format provides you with more control over the URL returned in search results. It also helps to make sure that properties such as link popularity are consolidated to your preferred version.”
So the whole point of canonical URL’s is that you have one url for multiple instances of the same content.
The Problem
Example:
http://www.mysite.com/
http://mysite.com
http://www.mysite.com/index.htm
http://mysite.com/
From my example all the url’s are technically different but in actuality they are the same website. Although all of these pages can be indexed by the search engines, which version should the search engine resolve when users are searching?
So, is it www or non www? Do I use the slash (/) or type index.htm?
To further complicate things all of the url’s contain the same content which could be considered by the search engines as duplicate content. The engines may “downgrade” all versions, or may/may not index all version of the page. Either way this is a loose-loose for your website.
The Solutions
Solution #1 – 301 redirect (.htaccess)
This first solutions is pretty straight forward but requires that you have access to your server’s root directory and a basic knowledge of rewrites. You will need to create a htaccess.txt file with a text editor such as Notepad and add this:
#
Options +FollowSymLinks
RewriteEngine On
#
# REDIRECT to canonical url
RewriteCond %{HTTP_HOST} ^mysite.com [NC]
RewriteRule ^(.*)$ http://www.mysite.com/$1 [R=301,L]
#
Once you have uploaded your new file to your server you will need to rename it to .htaccess
Solution #2- Canonical Tag
This is a <link> tag that can be added to the <head> section of a page like this:
<link rel=”canonical” href=”http://www.mysite.com” />
Adding this tag will tell Google, Yahoo , Bing and Ask that all other instances of this page (outlined in my example) should resolve the url http://www.mysite.com/
This solution works particularly well with e commerce sites as many of them have multiple instances of a product page , tracking parameters or a session ID.
Conclusions
It really doesn’t matter which url you pick, just pick one. Having both instances of the page does a heck of a lot of damage to you sites link popularity.
An easy way to check whether this may be a problem for you is to head over to Yahoo and check your site with the www and without.
linkdomain:www.mysite.com
linkdomain:mysite.com
If you get results for both www and non www and those results don’t match then you might consider using one of the solutions I’ve outlined here.
Tell your friends, Tell your colleagues, Tell a SMB...





