TECHNICAL AUDIT

Canonical URL: What It Is, How to Set It, and Common Mistakes

What canonical URLs are, how to set them correctly (HTML tag, HTTP header, sitemap), and the most common canonical mistakes that silently split your PageRank and confuse Googlebot.

A canonical URL tells search engines which version of a page is the "official" one — the one that should be indexed and that inbound link equity should flow to. It's one of the most important technical SEO tools and one of the most commonly misconfigured.

This guide covers what canonicals do, how to set them correctly, and the mistakes that silently hurt rankings.

What is a canonical URL?

A canonical URL is the URL you want search engines to treat as the definitive version of a page. It's declared with a <link rel="canonical"> tag in the <head> of the page:

<head>
  <link rel="canonical" href="https://example.com/blog/my-article" />
</head>

When Google sees a canonical tag, it treats the specified URL as the one to index and to attribute any link equity to. All other URLs with the same content — with parameters, with different protocols, with trailing slashes or without — are treated as duplicates pointing to the canonical.

The canonical tag is a signal, not a directive. Google typically respects it, but it can override your canonical if it determines that your specified URL is not actually the best version of the page (for example, if you canonicalise to a page that doesn't exist, or to a page that has different content).

Why canonical URLs matter

Without canonical tags, Googlebot must choose which version of a page to index on its own — and it may choose differently than you intend. Common duplicate scenarios:

  • https://example.com/page vs https://example.com/page/ (trailing slash)
  • http://example.com/page vs https://example.com/page (protocol)
  • https://www.example.com/page vs https://example.com/page (www vs. non-www)
  • https://example.com/page?utm_source=email vs https://example.com/page (tracking parameters)
  • https://example.com/page?sort=price vs https://example.com/page (filter parameters)

Each variation can be treated as a separate page by Googlebot. If you have 10 external links pointing to https://example.com/page and 5 pointing to https://www.example.com/page, the PageRank is split between two URLs rather than concentrated on one. A canonical tag on both pointing to the same URL consolidates that equity.

How to set canonical URLs

HTML <link rel="canonical"> tag

The most common method. Place it in the <head> of every page:

<link rel="canonical" href="https://example.com/canonical-page" />

Rules:

  • Always use absolute URLs (including https://). Relative canonicals (<link rel="canonical" href="/page">) are technically supported but ambiguous and occasionally misinterpreted.
  • Use HTTPS URLs if your site is HTTPS (which it should be).
  • Self-referencing canonicals (a page that canonicalises to itself) are valid and recommended — they prevent Google from choosing a different variant.
  • Every page should have exactly one canonical tag. Multiple canonical tags on the same page create a conflicting signal Google ignores.

HTTP header

For non-HTML resources (PDFs, videos, or pages served dynamically), you can set the canonical via an HTTP response header:

Link: <https://example.com/page>; rel="canonical"

This works the same way as the HTML tag. Useful for PDFs that you want indexed under a specific URL.

XML sitemap

Including a URL in your sitemap signals to Google that it's canonical, but this is a weaker signal than the <link rel="canonical"> tag. Use the sitemap as a complement to canonical tags, not a replacement.

Important: the URLs in your sitemap should match your canonical URLs exactly. Including https://example.com/page/ (trailing slash) in the sitemap when the canonical tag points to https://example.com/page (no trailing slash) creates a conflicting signal.

Self-referencing canonicals

Every page should have a canonical tag pointing to itself — even if there are no known duplicate versions. This is called a self-referencing canonical:

<!-- On https://example.com/about -->
<link rel="canonical" href="https://example.com/about" />

Self-referencing canonicals prevent Google from creating parameter variants (?ref=newsletter, ?session_id=xyz) or protocol duplicates in its index. They're a defensive measure.

Cross-domain canonicals

Canonical tags can point to a different domain. This is used when:

  • You syndicate content to other publications (point the syndicated copy's canonical to your original)
  • You have multiple regional domains that share content (example.co.uk canonicalises to example.com)
<!-- On the syndicated copy at other-site.com -->
<link rel="canonical" href="https://example.com/original-article" />

Cross-domain canonicals tell Google which site should get credit for the content. The linked-to site gets indexed; the canonical-to page doesn't compete in the index.

Common canonical mistakes

1. Canonicalising to a different URL than what's in the sitemap

Problem: The page has <link rel="canonical" href="https://example.com/page"> (no trailing slash) but the sitemap lists https://example.com/page/ (with trailing slash). Google sees conflicting signals.

Fix: Enforce trailing slash consistency across your entire site and ensure the sitemap, canonical tags, and internal links all use the same format.

2. Relative canonical URLs

Problem: <link rel="canonical" href="/page">. The relative URL can be misinterpreted if the page is accessed via an unexpected subdomain or in certain redirect contexts.

Fix: Always use absolute URLs: <link rel="canonical" href="https://example.com/page">.

3. Canonicalising paginated pages incorrectly

Problem: Paginating a blog into /page/2, /page/3, etc. and setting the canonical of all pagination pages to the first page (/page/1). This tells Google that pages 2+ are duplicates of page 1 and shouldn't be indexed — so the content on those pages can't rank.

Fix: Each paginated page should self-canonicalise (page 2's canonical points to page 2, page 3 to page 3). If you want to consolidate all paginated content to a single URL, use noindex on pages 2+, not canonicals.

4. JavaScript-rendered canonical tags

Problem: The canonical <link> tag is injected by JavaScript after page load rather than being present in the server-rendered HTML. Google's first crawl wave reads the raw HTML — a JavaScript-injected canonical may not be processed until the second crawl wave (days later).

Fix: Always render canonical tags server-side, in the initial HTML response. Next.js generateMetadata, Gatsby's <Head> API, Nuxt's useSeoMeta(), and all major CMS plugins render canonicals server-side by default.

5. Noindex + canonical conflict

Problem: A page has both <meta name="robots" content="noindex"> and <link rel="canonical" href="...">. These send contradictory signals: "don't index this page" and "this is the canonical version to index."

Fix: If you don't want a page indexed, use noindex only. Don't add a canonical to a noindex page. If you want a page indexed under a specific URL, use the canonical without noindex.

6. Canonicalising to a 404 or redirect

Problem: The canonical tag points to a URL that returns a 404 or a redirect rather than the actual page. This is common after a site migration where canonical tags weren't updated.

Fix: The canonical URL must return a 200 status with the content you want indexed. Audit your canonicals after any URL restructure or migration.

7. Canonical chain

Problem: Page A canonicalises to page B, which canonicalises to page C. Google follows the chain but has to do extra work, and the signal is weaker than a direct canonical.

Fix: Always canonicalise directly to the final, definitive URL. If B redirects to C, point A's canonical to C directly.

8. Missing canonical on the homepage

Problem: The homepage is accessible at https://example.com, https://example.com/, https://www.example.com, and (if HTTPS isn't forced) http://example.com. Without canonicals and redirects, these appear as four different pages.

Fix: (1) Set up 301 redirects from all variants to your preferred version (e.g., all redirect to https://example.com). (2) Add <link rel="canonical" href="https://example.com/"> to the homepage. Both together create redundant protection.

How to audit your canonical tags

Quick checks:

  1. View source on any page and search for <link rel="canonical". Confirm the URL is: absolute, HTTPS, and matches exactly how the URL appears in your sitemap.
  2. Compare the canonical URL to the URL in your browser address bar — are they the same? Any difference is worth investigating.
  3. In Google Search Console → URL Inspection → enter a page URL → check "Canonical URL declared by page" vs. "Google-selected canonical". If Google's chosen canonical differs from yours, it's overriding your tag.

The DeepSEOAnalysis free audit checks canonicals across all crawled pages:

  • Missing canonical tags (every page should have one)
  • Canonical URLs that don't resolve to a 200 status
  • Canonical conflicts with noindex tags
  • Canonical/sitemap URL mismatches
  • Pages where multiple canonical tags were detected

Frequently asked questions

Should every page have a canonical tag?

Yes. Every indexable page should have a canonical tag — ideally self-referencing (pointing to itself). This prevents Google from canonicalising to an unexpected variant (with parameters, with a different protocol) and makes your intent explicit. Pages with noindex don't need canonical tags.

Does rel=canonical pass link equity?

Not directly — the canonical tag tells Google to attribute the page's link equity to the canonical URL. External links to a non-canonical version are attributed to the canonical. Internal links should point directly to the canonical URL, not to a redirected or parameter variant.

What's the difference between a canonical tag and a 301 redirect?

A 301 redirect sends both users and crawlers to a new URL — the old URL is no longer served. A canonical tag keeps the original URL accessible (users can still visit it) while telling Google which version to index. Use 301 redirects when a URL has permanently moved; use canonical tags when a URL should remain accessible but you want to signal which version is authoritative (for parameter URLs, for example, where removing the parameter from the URL would break the filter UI).

Can canonical tags hurt SEO?

Yes, if misconfigured. The most common harmful canonicals: pointing all pages to the homepage (accidentally canonicalising away your entire content library), canonicalising paginated pages to page 1 (removing pages 2+ from the index), and canonicalising to 404 pages (breaking the indexation signal). An SEO audit checks for these patterns automatically.

Run DeepSEOAnalysis on your own site.

Free, no signup. Technical SEO, Core Web Vitals, structured data, and AI visibility in one report.

Run a free audit →