All guides · SEO

Canonical URLs (rel=canonical)

The same page is often reachable under several URLs: with and without www, with tracking parameters, with a trailing slash or without, through a print view or a sorted listing. A canonical link names the one URL you want search engines to treat as the main version:

<link rel="canonical" href="https://example.com/shoes/trail" />

Why it matters

When search engines find several URLs with the same or very similar content, they pick one to show in results and group the others with it. Without a canonical link, they guess. The guess may be a URL with session or tracking parameters, or a version you did not mean to publish.

A canonical link is a strong hint, not a command. Google combines it with other signals, such as redirects, internal links and sitemap entries, and can choose a different URL if those signals disagree. The best results come when every signal points at the same URL.

What we check

We read the first <link rel="canonical"> in the HTML of the final page (after redirects).

Result When
Pass the href is an absolute URL on the same hostname as the scanned page
Needs attention there is no canonical link
Needs attention the href is relative, such as /shoes/trail
Needs attention the href points at a different hostname

“Different hostname” includes www.example.com versus example.com. If that is intentional (for example, the scanned host redirects or is a syndicated copy), you can ignore the result.

We only read the HTML <link> element. A canonical sent as an HTTP Link header is not detected by this check.

How to fix

Add a self-referencing canonical to every indexable page, using the full URL you want in search results: scheme, preferred host and path.

<head>
  <link rel="canonical" href="https://example.com/shoes/trail" />
</head>
  • Use absolute URLs. Relative URLs are allowed by the specification, but they break easily when a page is served from another host, a staging server or a proxy. Absolute URLs remove the doubt.
  • Match your preferred host and scheme. If you redirect to https://example.com, the canonical should not say http:// or www..
  • Strip parameters that do not change the content, such as utm_*, session IDs or sort order.
  • Put it in the <head>, once per page. Google ignores canonical links that appear in the <body>, and conflicting tags can cause all of them to be ignored.
  • Generate it server-side. Most CMSs and frameworks have a setting or plugin for this. Make sure it outputs the real page URL, not the home page for every page.

For non-HTML files such as PDFs, send the canonical as a response header:

Link: <https://example.com/guides/sizing.pdf>; rel="canonical"

Common mistakes

  • Every page points to the home page. This tells search engines that all your pages are duplicates of the home page. Each page should point to itself unless it really is a duplicate.
  • Canonical to a URL that redirects or returns 404. Point to the final, working URL.
  • Canonical and noindex together. These send mixed signals. If a page is a duplicate, use a canonical. If it should not be in search at all, use noindex. See the noindex guide.
  • Paginated pages all pointing to page 1. Page 2 of a listing is not a duplicate of page 1. Give each page its own canonical.

Google documents how it picks canonical URLs in Consolidate duplicate URLs.

Last updated October 24, 2026