Canonical Tags Explained: How rel=canonical Handles Duplicate URLs
What is a canonical tag?
A canonical tag is a <link rel="canonical"> element in a page's head that tells search engines which URL is the preferred version when several URLs show the same or very similar content. Google treats it as a strong hint, not a command, and weighs it alongside redirects, internal links and sitemaps when choosing the canonical URL to show in search results.
Canonicalisation: the problem canonical tags solve
The same page can often be reached through many URLs. A product might appear at /shirts/blue-oxford/, at /shirts/blue-oxford/?colour=blue, at /sale/blue-oxford/ and at an http:// or non-www variant. To a search engine these are different URLs with duplicate content. Canonicalisation is the process of choosing one representative URL from that group.
- Canonical URL: the URL a search engine chooses to represent a set of duplicate pages. It is the one usually shown in results.
- Declared (user-selected) canonical: the URL you name with rel=canonical or other signals.
- Google-selected canonical: the URL Google actually picks, which may differ from your declaration.
- Duplicate URL: any other URL in the group. Google crawls it less often and consolidates its signals into the canonical.
Without a clear choice, Google picks a canonical itself. That choice is often sensible, but it may select a tracking URL or an old variant, and your reports become harder to read. Canonical tags fit into wider technical SEO work on crawling and indexing.
Why rel=canonical is a hint, not a directive
Google's documentation describes several canonicalisation signals and how strongly each one counts. Redirects are strong signals, rel=canonical is a strong signal, and inclusion in an XML sitemap is a weaker one. Google combines them with other evidence, such as which URL internal links point to and whether the page is served over HTTPS.
Because the tag is a hint, Google can ignore it when other signals disagree. If your canonical points to page A but every internal link and the sitemap point to page B, Google may choose B. If the two pages are not really duplicates, Google may index both. Consistency across signals is what makes a canonical stick.
| Method | Strength as a signal | Typical use |
|---|---|---|
| 301 or 308 redirect | Strong | The duplicate URL should no longer be visited at all |
| rel=canonical link element | Strong | Duplicates must stay accessible, such as filtered or tracked URLs |
| rel=canonical HTTP header | Strong | Non-HTML files such as PDFs |
| Listing in an XML sitemap | Weak | Supporting signal for the preferred URL |
How to add a canonical tag, including self-referencing canonicals
Place the link element inside the <head> of the duplicate page and use a full absolute URL. Google ignores rel=canonical found in the body.
<!-- On https://example.com/shirts/blue-oxford/?utm_source=newsletter -->
<head>
<link rel="canonical" href="https://example.com/shirts/blue-oxford/">
</head>A self-referencing canonical is a canonical tag on the preferred page that points to its own URL. It is not required, but it is a common safeguard: when someone links to the page with tracking parameters or a different letter case, the tag still names the clean URL. Many CMS platforms and SEO plugins add it automatically.
Canonical in an HTTP header for PDFs and other files
A PDF has no HTML head, so the server sends the canonical as a Link response header instead. This is useful when the same document is published at two paths, or when a PDF duplicates an HTML page.
HTTP/1.1 200 OK
Content-Type: application/pdf
Link: <https://example.com/downloads/fee-structure.pdf>; rel="canonical"On Apache, you could send that header with mod_headers for one file:
<Files "fee-structure-2026.pdf">
Header set Link "<https://example.com/downloads/fee-structure.pdf>; rel=\"canonical\""
</Files> Common canonical conflicts and how to fix them
- Canonical to a redirected or broken URL: the target must return 200 and be indexable. Point straight at the final URL.
- Canonical plus noindex on the same page: the two send mixed messages. Use a canonical to consolidate duplicates; use noindex only when a page should not appear in search at all.
- Canonical to a URL blocked in robots.txt: Google cannot crawl the target, so it cannot confirm it. Keep the canonical URL crawlable, as the robots.txt guide explains.
- Several canonical tags on one page: often caused by a theme and a plugin both adding one. Google may ignore all of them. Keep exactly one.
- Every paginated page pointing to page 1: page 2 and page 3 hold different products or posts, so they are not duplicates. Give each paginated page a self-referencing canonical.
- Internal links and sitemap pointing elsewhere: link to the canonical URL everywhere and list only canonical URLs in your XML sitemap.
- Relative URLs gone wrong: a relative canonical on a staging host can point to the staging domain. Absolute URLs avoid this.
Checking canonicals in Search Console
- Open the URL Inspection tool in Google Search Console and enter a URL.
- Compare "User-declared canonical" with "Google-selected canonical". If they differ, Google has overruled your hint.
- Open the Page indexing report and review reasons such as "Duplicate, Google chose different canonical than user" and "Duplicate without user-selected canonical".
- For each pattern, check whether internal links, redirects, hreflang and sitemaps all agree with your declared canonical.
- Fix the conflicting signal, then use Validate fix in the report so Google rechecks the affected URLs.
"Alternate page with proper canonical tag" is normally fine. It means Google found a duplicate, saw your canonical and respected it.
Practical exercise: audit the canonicals on five URL variants
Pick one page on a site you manage. Build five variants of its URL: with a tracking parameter, with a trailing slash removed, in uppercase, over http:// and with the non-preferred host. Open each variant, view the page source and record the canonical URL, the HTTP status and whether a redirect happened. You can check headers from a terminal with curl -sI "https://example.com/page/?utm_source=test".
You are done when every variant either redirects to the preferred URL or carries a canonical that points to it, the preferred page has a self-referencing canonical, and URL Inspection shows the Google-selected canonical matching your choice. Auditing indexing signals like these is covered in depth in the technical SEO course.
Common mistakes
- Expecting rel=canonical to override strong opposite signals such as internal links and sitemap entries.
- Pointing the canonical at a URL that redirects, returns 404 or is noindexed.
- Placing the canonical link in the body, or injecting it late with JavaScript that may not be rendered as expected.
- Canonicalising all paginated, filtered or category pages to the homepage or to page 1.
- Copying a staging site to production with canonicals still pointing at the staging domain.
Frequently asked questions
Can a canonical point to another domain?
Yes. Cross-domain canonicals are supported, for example when an article is syndicated to a partner site that agrees to point back to the original. The same hint rules apply, so the content must be substantially the same.
Should I use a canonical or a 301 redirect?
Use a 301 when visitors no longer need the duplicate URL, such as an old address after a restructure. Use a canonical when the duplicate must still work for users, such as a sorted or tracked version of a page.
Does a canonical tag pass link signals?
Google consolidates signals from duplicate URLs into the canonical it selects. That only works reliably when Google agrees with your canonical, which is why matching signals matter.