Do you have a problem with duplicate content on your site?  If your site suffers from duplicate content problems due to dynamically generated url’s that include session id’s, category markers, product id’s, etc. then you might have a problem when it comes to ranking well in the search engines.

As most people know, the search engines, especially Google, like to steer clear of content that has been duplicated somewhere else on the web or within a website.  And, when optimizing a database driven site it can be very hard to build static url’s without duplicating previously created dynamic url’s.

With canonical links, you can eliminate the problem of having dynamic and static pages with the same content.  If you have site categories that tend to share the same data (ie. computer desks and office desks), you can use canonical links to tell the search engines which one is the most important and which to ignore.  The great thing – this doesn’t affect the functionality of your website.

Here’s a quick example of how canonical links work:

  • URL 1: http://www.yourdomain.com/product.php?cat_id=52
  • URL 2: http://www.yourdomain.com/product.php?sessionid=1234
  • URL 3: http://www.yourdomain.com/product/widgets.php

Assuming that the above URL’s all display the exact same content, and for the purpose of good website optimization, you’ll want to use the URL 3.  So, how do you tell the search engines not to worry about the content on URL 1 or URL 2?  Simple – use a canonical link url in the <head> section of the pages you don’t want ranked.

All you need to do is use the follow url structure just inside the opening head tag:

<head>
<link rel=”canonical” href=”http://www.yourdomain.com/product/widgets.php”/>

If you want, you can even use a relative URL path such as:

<head>
<link rel=”canonical” href=product/widgets.php” />

If you use a <base> link in your page, all relative paths will resolve to the base URL.

Want more information on Canonical Links – check out Google’s Webmaster Central Blog.