Scroll To Top

I find there is still some confusion with canonical link tag. I'd like to explain and provide resources to everything canonical tag realted in this article.

What does Canonical link tag do?

A canonical link tag is used to replace a 301 redirect, when you don't have access the tools necessary to redirect a page. It's main intent is to reduce duplicate content crawled by search engines.

In this video, Matt Cutts recommends using 301 redirects instead of canonical links. He gives good examples and explains when to use each option. Update: In later videos he says to use both.

How To Use A Canonical Link Tag

The tag goes in the <head> tags on your page. It looks like this:

<link rel="canonical" href=""/>

PHP Canonical Link Tag

Here is a PHP snippet for your website for your tag:

$canonicalLink =  "http://".$_SERVER['HTTP_HOST'].$_SERVER["REQUEST_URI"]; 

Canonical Link Tag Gotchas

Canonical tags only work within your domain, for example when your redirecting www to non-www.

301 Redirect

If you have the option to do 301 redirects but don't know how, checkout my article Using Apache for 301 redirects.

Canonical Loop

Google handles a canoincal loop, so you can point a page to itself. You still might not want to do this as it is unclear how search engines other than Google handle a canonical loop.