Skip to content
Sign in

Canonical tags: how to set them and the mistakes that cost rankings

One correct line in the head consolidates duplicate URLs; one wrong line can deindex a whole section. The rules, the classic mistakes, and how to check.

DeskSEO editorial team · · 5 min read

The same content often lives at several addresses: with and without www, with tracking parameters, with a trailing slash, sorted or filtered, printed or paginated. A canonical tag tells search engines which of those addresses is the main one, so links and ranking signals collect on a single URL instead of being split. Done right, it is one line in the <head>. Done wrong, it can quietly remove pages from the index.

The correct form

<link rel="canonical" href="https://example.com/guides/blue-widgets">

Four rules cover most sites:

  1. Absolute URL. Include the scheme and host. href="/guides/blue-widgets" is accepted by Google, but it breaks as soon as the page is served on a staging host, a mirror or a proxy, because the relative path resolves against whatever host served it.
  2. HTTPS, final host. The canonical should be the exact URL that returns 200 after all redirects: same protocol, same www choice, same trailing slash convention.
  3. Self-referencing on normal pages. Every indexable page points to itself. It costs nothing and protects against parameter duplicates (?utm_source=…, ?ref=…) you never created but others link to.
  4. Exactly one. One canonical per page, in the <head>. When several conflicting canonicals appear, Google may ignore all of them.

The canonical can also be sent as an HTTP header, which is the only option for non-HTML files such as PDFs:

Link: <https://example.com/files/price-list.pdf>; rel="canonical"

A canonical is a hint, not a command

Google treats rel="canonical" as a strong signal, combined with others: redirects, internal links, the sitemap, hreflang and which version gets linked from outside. When these signals disagree, Google picks its own canonical. Search Console shows this in the URL Inspection tool as "Google-selected canonical" differing from "User-declared canonical", and in the Pages report as "Duplicate, Google chose different canonical than user".

So the goal is not just to add the tag but to make every signal point to the same URL:

  • Internal links use the canonical URL, not variants.
  • The sitemap lists only canonical URLs (see XML sitemaps).
  • Non-canonical hosts and protocols redirect to the canonical with a 301 (see HTTPS, www and redirects).
  • hreflang annotations reference canonical URLs only.

The mistakes that cost rankings

Every page canonicalised to the homepage

A theme or plugin outputs the same hard-coded canonical on every template, usually the homepage. To Google, that reads as "all these pages are duplicates of the homepage, index only the homepage". Category and article pages then drop out of results over a few weeks. This is one of the most damaging single-line bugs in SEO, and it often arrives with a theme update. The DeskSEO checker flags it as Canonical points to another host or page.

Canonical pointing to the staging or old domain

After a migration or a copy from staging, canonicals still say https://staging.example.com/… or the old brand domain. Google may then treat the old host as the original. Search the page source for the old hostname after every migration.

http:// canonicals on an https site

The page loads on https but declares http://example.com/… as canonical. Google can work it out because the http version redirects, but you are sending contradictory signals for no reason. Generate canonicals from the same base URL setting the site uses for links.

Two canonicals: theme plus SEO plugin

Common on WordPress and similar systems: the theme prints one canonical and the SEO plugin prints another. If they match it is harmless duplication; if they differ (for example one includes pagination, the other does not), Google may ignore both. View the source and search for rel="canonical"; there should be one hit.

Canonical to a page that redirects, 404s or is noindex

A canonical must point to a live, indexable page that returns 200. Pointing to a URL that redirects creates a chain of hints; pointing to a 404 or a noindex page gives Google two instructions that cancel each other. Mixing noindex with a canonical to another URL is a classic case: use one or the other.

Canonical added by JavaScript only

Google can read a canonical injected by JavaScript after rendering, but a canonical in the raw HTML is processed earlier and more reliably, and other crawlers may never see the rendered one. If the raw HTML has a different canonical than the rendered page, the signal is contradictory. Keep it in the server-rendered HTML (see JavaScript sites and crawlers).

Parameters, filters and sorting

For URLs that only reorder or track, point the canonical at the clean URL:

https://example.com/shoes?sort=price_asc
  → canonical: https://example.com/shoes
https://example.com/shoes?utm_source=newsletter
  → canonical: https://example.com/shoes

Filters that create genuinely different content are a judgement call. "Red running shoes" may deserve its own indexable page with its own self-canonical if people search for it; a combination of five filters almost certainly does not. A practical rule: give self-canonicals only to filter pages you would be happy to link from your main navigation, and canonicalise the rest to the parent category.

Pagination

Page 2, 3 and onward of a list should normally carry self-referencing canonicals, not a canonical to page 1. The products or articles on page 3 are not on page 1, so declaring page 3 a duplicate of page 1 hides them from discovery through that path. Google no longer uses rel="next"/rel="prev" as an indexing signal, so make sure deeper items are also reachable through normal links and the sitemap. If you offer a "view all" page that loads acceptably fast, canonicalising the paginated pages to it is a valid alternative.

Cross-domain canonicals

When the same article is republished on a partner site, the partner can add a canonical pointing back to your original. This is legitimate and Google supports it, but it is still a hint: the partner's copy may rank instead of yours if it is better linked. For syndication you control, ask for the canonical and a visible link back to the original.

Checking your canonicals

  1. Run the SEO checker on your homepage: it reports a missing canonical, a relative one, an http one, more than one, or one pointing elsewhere, each with the value it found.
  2. For important templates (category, article, product), open the source of one example and confirm the canonical is the page's own absolute URL.
  3. In Search Console, open URL Inspection for a few key URLs and compare "User-declared canonical" with "Google-selected canonical".
  4. Check the Pages report for "Duplicate, Google chose different canonical than user" and look for a pattern in the URLs listed.

Questions

Does every page need a canonical tag?

It is not mandatory, but a self-referencing canonical on every indexable page is cheap insurance against parameter and host duplicates you did not create.

Can a relative canonical URL work?

Google accepts it, but it resolves against whatever host served the page, which goes wrong on staging hosts, mirrors and proxies. Use absolute https URLs.

Should paginated pages point their canonical to page 1?

Usually not. Page 2 and beyond contain different items, so they should canonicalise to themselves, unless you deliberately consolidate into a fast view-all page.

Why does Google ignore my canonical?

Because other signals disagree: internal links, redirects, the sitemap or external links point to a different version. Align every signal on the same URL.

Keep reading