Do canonical links require a full domain?

Directly from Google:

http://support.google.com/webmasters/bin/answer.py?hl=en&answer=139394

Can the link be relative or absolute?
rel="canonical" can be used with relative or absolute links, but we recommend using absolute links to minimize potential confusion or difficulties. If your document specifies a base link, any relative links will be relative to that base link.


Again, Google says this:

https://support.google.com/webmasters/answer/139066?hl=en

Avoid errors: use absolute paths rather than relative paths with the rel="canonical" link element.

Use this structure: https://www.example.com/dresses/green/greendresss.html

Not this structure: /dresses/green/greendress.html).

For example’s sake, these are their URLs:

http://example.com/wordpress/seo-plugin/

http://example.com/wordpress/seo/seo-plugin/

This is what rel=canonical was invented for. Especially in a lot of e-commerce systems, this (unfortunately) happens fairly often, where a product has several different URLs depending on how you got there. You would apply rel=canonical in the following method:

You pick one of your two pages as the canonical version. It should be the version you think is the most important one. If you don’t care, pick the one with the most links or visitors. If all of that’s equal: flip a coin. You need to choose.
Add a rel=canonical link from the non-canonical page to the canonical one. So if we picked the shortest URL as our canonical URL, the other URL would link to the shortest URL like so in the <head> section of the page:

<link rel="canonical" href="http://example.com/wordpress/seo-plugin/">

That’s it. Nothing more, nothing less.


All href attributes are hypertext references - that's what it stands for. As such, they are always URI-References, not URIs, and can be relative.

In this case though, there's a benefit in putting in the full URI if you can, because it will survive anything that migrates it onto another domain in the future (assuming you will still want the domain listed to be the canonical one), and can even survive some of the cruder automated plagiarisms :)

That benefit is pretty slight if you aren't actively using non-canonical versions on other domains though, so I wouldn't expend much effort on it.