Your homepage can load as https://www.example.com/, as https://example.com/ or as http://example.com/. To you it is the same page; to Google it is three different addresses serving identical content. If someone also links to a URL with tracking parameters, that makes four.
The rel="canonical" tag exists to tell Google which of those versions is the one that should count. It is a tiny line of code that is misconfigured surprisingly often, so it is worth understanding how it really works.
What the canonical tag actually does
It is an element in the page's <head>, shaped like this: <link rel="canonical" href="https://www.example.com/trainers/">. It names the preferred (or "canonical") URL within a group of identical or very similar pages. Google clusters those duplicates, picks one as the representative and consolidates signals onto it instead of spreading them across several addresses.
One detail that is often missed: the canonical is a hint, not a command. Google weighs it against other signals (redirects, internal links, the sitemap, use of https) and, if they contradict each other, it may choose a different URL from the one you declared. For files with no <head>, such as a PDF, you can declare it with the Link HTTP header instead.
Self-referencing canonicals and when to use them
The recommended practice is for every indexable page to carry a canonical pointing to itself, using the full absolute URL (protocol and domain included, not a relative path). It is your safety net against things you do not control: if someone links to /trainers/?utm_source=newsletter, that URL loads the same code and therefore declares the clean version as canonical.
Beyond the self-referencing canonical, it makes sense in these cases:
- Parameters that do not change the underlying content: tracking (
utm_), sorting, session IDs. - Near-identical product variants (say, the same item in several colours with the same description) that you do not want competing with each other.
- Content you republish on another domain, pointing back to the original.
One important nuance: if a duplicate URL should not exist for anyone (the classic http versus https), the right tool is a 301 redirect, not a canonical. A canonical leaves both addresses reachable; a redirect sends people and bots to just one.
Contradictory canonicals: the mistakes we see most
Nearly every problem comes from sending opposing signals. These are the usual suspects:
- A canonical pointing to a URL that redirects, returns a 404 or carries noindex.
- Two different canonical tags on the same page, because the theme and a plugin each add their own. Google may ignore both.
- A canonical and noindex together: you are saying "this is the good one" and "do not index it" in the same code.
- Every page in a paginated series pointing to page 1, which leaves the content of the later pages out.
- Every page on the site pointing to the homepage "just in case".
- A canonical placed outside the <head> (injected into the body by a script, for instance), which is not taken into account.
Also check that the canonical matches the URL in your sitemap and your internal links. If the sitemap lists one address and the canonical declares another, you are asking Google to guess.
Trailing slashes, http/https, www and parameters
Technically, /services and /services/ are different URLs (only at the root of the domain does the slash not matter). The same goes for http and https, or www and non-www: these are combinations of the same domain that can all return the same content. Pick one convention and stick to it everywhere: redirect the others with a 301 and make the canonical, internal links and sitemap always use the chosen one.
With parameters, the test is whether they change what people see. A ?sort=price reorders the same listing; a ?page=2 shows different items and should not be canonicalised to the first page.
How to check that Google is listening
Open the page source (Ctrl+U) and search for canonical: there should be exactly one. With curl -I you can confirm that the variants redirect with a 301 to the final version. In Search Console, URL Inspection shows the "user-declared canonical" and the "Google-selected canonical"; if they differ, Google disagrees with you and it is time to find out why. The Pages report also lists cases such as "Duplicate, Google chose different canonical than user".
Frequently asked questions
Canonical or 301 redirect?
If the duplicate URL has no reason to be visited, use a 301 redirect. If both URLs need to keep working (for example, one with a tracking parameter), use a canonical.
Can I point a canonical to another domain?
Yes, it is valid and commonly used when you republish content and want the original to be the one that ranks. Since it is only a hint, Google may ignore it if the pages are not genuinely equivalent.
Does a small website need canonicals?
The self-referencing canonical is still a good idea because it is free and protects you from unexpected parameters. But if your site has few pages, one version of each URL and generates no variants, the real risk of duplicates is low.