Start with the fact that overturns half of what people assume about this tag: rel="canonical" is a hint, not a command.
Google weighs it alongside every other signal — internal links, the sitemap, redirects, hreflang. When those signals disagree, the search engine picks the URL it considers correct and ignores your canonical. This is stated in Google's own documentation on consolidating duplicate URLs.
Everything else follows from that: canonical does not work on its own, only when the other signals point the same way.
Syntax
The tag belongs in <head>:
<link rel="canonical" href="https://example.com/page">
Three rules that get broken most often:
Use an absolute URL. Relative paths are technically allowed, but any error in the base URL turns them into garbage. Write it out in full, scheme and host included.
Exactly one tag. Two different canonical links on a page and Google discards both. This is the classic result of running two SEO plugins at once.
Inside <head> only. A canonical that ends up in <body> — injected by a script into the wrong place, for instance — is not counted.
For files with no HTML of their own (PDFs, images), canonical travels as an HTTP header:
Link: <https://example.com/document.pdf>; rel="canonical"
What canonical solves
One problem: the same content lives at several URLs, and all of them have to stay reachable.
Typical cases:
- sorting and filter parameters:
?sort=price,?color=red; - UTM tags and advertising identifiers;
- one product listed under several categories;
- printer-friendly versions;
- the same material on different subdomains.
In none of these can you simply redirect — the page is needed. Canonical tells the search engine which address to treat as primary and consolidates signals onto it.
Self-referencing canonical
A page may point its canonical at itself. Not mandatory, but useful: it insures you against someone opening your URL with a stray parameter appended and the search engine treating that as a separate page.
What canonical is not
This is where most mistakes live, so here are the neighbouring tools in one table.
| Goal | Tool | Why not canonical |
|---|---|---|
| Page has moved permanently | 301 redirect | Canonical leaves the old URL reachable |
| Destination changes temporarily | 302 redirect | Same reason |
| Page must not be indexed | noindex |
Canonical does not remove anything from the index |
| Page should not be crawled | robots.txt | Which does not remove it from the index either |
| Same content in several languages | hreflang + self-canonical | These are not duplicates |
| Paginated listings | Nothing | Pages 2, 3, 4 stand on their own |
Two entries deserve emphasis.
Canonical does not replace a 301. If a page genuinely moved, redirect it. Canonical is for situations where both URLs must keep working.
Pagination is not duplication. Pointing the canonical of every listing page at page one is a common error: the content of pages 2 and 3 differs, and you are simply removing it from the index.
Canonical and hreflang
The subtlest part, and home to the single most expensive mistake in this area.
The mistake: canonicalising every language version to the English one. The logic feels sensible — English is the "main" version. The outcome is the opposite: you tell the search engine that the German and Spanish pages are not independent, and they drop out of results in their own markets.
The correct arrangement:
- every language version points its canonical at itself;
- all versions list one another via
hreflang, including themselves; - the relationships are reciprocal: if A references B, B must reference A;
hreflangpoints at canonical URLs, not at parameterised variants;x-defaultnames the fallback for visitors whose language matches nothing.
That is how the site you are reading is built. The page about shortening YouTube links exists in 21 language versions, and each one canonicalises to itself. The Chinese version looks like this:
<link rel="canonical" href="https://lix.li/suoduan-youtube-lianjie">
<link rel="alternate" hreflang="en" href="https://lix.li/shorten-youtube-link">
<link rel="alternate" hreflang="zh" href="https://lix.li/suoduan-youtube-lianjie">
<link rel="alternate" hreflang="es" href="https://lix.li/acortar-link-youtube">
Note that the canonical points at the Chinese URL rather than the English one, and that the Chinese version appears in its own hreflang list.
Common mistakes
Google catalogued the main ones years ago in its note on five mistakes with rel=canonical, and the list has barely changed since.
Canonical pointing at a URL that returns 404. The tag is ignored entirely.
Canonical pointing at a noindex page. Contradictory signals: you are saying "treat this one as primary" and "do not index it" at the same time.
Canonical pointing at a URL blocked in robots.txt. The crawler cannot fetch it, so it cannot confirm it either.
Chains. A points at B, B points at C. In Search Console that becomes "canonical not selected". Point straight at the final URL.
Mixing http with https, www with non-www. The scheme and host in the canonical must match the version of the site you treat as primary.
Canonical and noindex on the same page. Pick one.
When Google chooses a different URL
In Search Console this appears as "Duplicate, Google chose different canonical than user".
It is neither a markup error nor a penalty. It is a message that the other signals outweighed your tag. What to check:
- Internal links. If the whole site links to the parameterised variant while the canonical points at the clean URL, the search engine believes the links.
- The sitemap. It should contain canonical URLs only.
- Redirects. If the canonical points at a URL that itself redirects somewhere, the tag loses its force.
- Whether these really are duplicates. If the content differs noticeably, the search engine is right to treat the pages as distinct.
Align the signals and the tag starts working. Arguing with the algorithm is pointless; it reads the whole picture.
Short links and canonical
A question that comes up often and that general guides do not answer.
Does a short link create a duplicate of the page? No.
A shortener does not serve a copy of the content — it returns an HTTP redirect. A 302 response has no body and no <head>, so there is physically nowhere to put a canonical. The crawler follows the redirect and works with the destination, which carries its own canonical. How that mechanism works is covered in the piece on how URL shorteners work.
Short links on this site additionally return the header X-Robots-Tag: noindex, nofollow, explicitly asking that the redirect itself not be indexed.
What about a custom short domain? It creates no duplicates either, as long as it redirects. Duplicates appear when you serve identical content on two domains without redirecting — that is exactly when you need a canonical pointing at the primary one. Why a custom domain for short links is worth having is covered separately, and you can connect one on the custom domains page.
Short checklist
- One canonical per page, inside
<head>, absolute URL. - The target returns 200, is not blocked in robots.txt and is not marked
noindex. - No chains — point straight at the final URL.
- Every language version canonicalises to itself; hreflang is reciprocal.
- Sitemap and internal links lead to the same canonical URLs.
- Pagination and moved pages are solved with their own tools, not with canonical.