SEO and marketing

Canonical URL: how to tell Google which version of your page to choose

By Edgar Jaimes 4 min read

Laptop screen showing a web page's HTML code open in an editor

Your same page can open under several URLs and compete against itself. Learn to use redirects, rel canonical and sitemap so Google picks the right one.

You share the link to your services page on WhatsApp and it opens with www for one client, without www for another, and with a ?utm_source= stuck on the end for a third. To you it's a single page. To Google it can be three, and it has to decide which one to show.

That decision is called canonicalization, and you can guide it. Google's documentation on duplicate URLs explains how. Here is the essentials, without the jargon.

What is a canonical URL?

It is the version of a page that you want Google to show when several URLs have the same or very similar content. If you don't choose one, Google picks the one it considers best for users, and it doesn't always match the one you would have chosen.

Duplicates often appear without you noticing: versions with and without www, with and without a trailing slash, with campaign parameters, or the same product page in two categories. If you want to tidy up the parameters, start with the rules for clean URLs.

Hands holding a phone in front of a laptop showing an open web page
The same page arrives through different links depending on where you share it. Foto: Unsplash

What methods exist to indicate the canonical?

There are three, and they don't carry the same weight. Google describes them in this order of influence:

MethodSignal strengthWhen to use it
301 redirectStrongWhen you retire a duplicate page and want everyone to land on the other one
rel="canonical" tagStrongWhen both URLs must keep existing
SitemapWeakTo suggest the preferred version, always as support

According to Google, you can combine them, and that increases the likelihood that the URL you prefer is shown. For the first method, you'll find the step by step in our guide to 301 redirects in Cloudflare Pages.

How do you write the rel canonical tag correctly?

It goes inside the page's <head> and points to the preferred URL, with the full address. An example:

<link rel="canonical" href="https://tudominio.com/servicios/" />

The practices Google recommends:

  • Include a canonical that points to the page itself (self-referencing).
  • Use absolute URLs, not relative ones.
  • Always link internally to the canonical version, not to the duplicates.
  • Choose either the HTML tag or the HTTP header, not both at once. The header works for files that are not HTML, such as PDFs.
  • Don't indicate different canonicals for the same page in different methods.

If your site is in several languages, each version must point to a canonical in its own language, as we explain in hreflang for multilingual sites.

Common mistake: putting the same canonical on every page, for example pointing to the home page. Each page with its own content must point to itself. Otherwise, you are asking Google to ignore the rest of your site.

What should you not do to resolve duplicates?

Don't use robots.txt, noindex or the URL removal tool. Google says so explicitly: a URL blocked in robots.txt can still be indexed, without its content; noindex blocks the page entirely instead of choosing a version; and the removal tool hides all versions of the URL.

Wooden table with a notebook, hands writing, a tablet and a laptop
Listing your URLs on paper before touching the code prevents mistakes. Foto: Unsplash

Also don't declare a fragment (whatever comes after #) as the canonical, and don't mix different addresses across methods.

What do I do if Google chooses a different canonical?

Check URL inspection in Search Console and decide whether the one Google chose makes sense. The troubleshooting guide suggests checking which URL Google selected and, if it isn't yours, looking for the cause.

Common causes are near-identical pages that Google groups together, country or language versions without hreflang, and plugins or templates that add unexpected canonicals or redirects. In that case, check the HTML in your browser's developer tools. If you make changes, Google says it can take up to two weeks to re-evaluate, and that you should request indexing only for your most important URLs.

If you are just publishing your site, combine this with what we explain in Search Console and sitemap.

In short

Back to the WhatsApp link that opens differently for each client: the solution isn't for everyone to type the same address, but to tell Google which one is official. Redirect what's left over, put a self-referencing canonical on every page, always link to that version and leave the sitemap as support. If you want us to review your website's structure, check out our SEO and GEO service.

Frequently asked questions

What is a canonical URL?

According to Google, it is the version of a page you prefer to appear in results when several URLs show the same or very similar content. If you don't specify one, Google chooses the one it considers best for users.

Does Google always obey my rel canonical tag?

No. Google treats it as a strong signal, but it decides on its own which pages are duplicates. That is why you should combine it with redirects, consistent internal links and the sitemap.

Can I use robots.txt or noindex to avoid duplicates?

Google advises against it. A URL blocked in robots.txt can still be indexed without its content, and noindex removes the entire page from the search engine instead of choosing a version.

Should the canonical tag use a relative or absolute URL?

Absolute. Google recommends using absolute URLs rather than relative ones, because relative ones can cause problems.

How long does Google take to recognize a canonical change?

Google says it can take up to two weeks to re-evaluate similar pages. Request indexing only for your most important URLs, because the tool has quotas.

Do not stop at the theory: apply it to your business

We implement SEO and GEO with AI end to end, with your real operation. The first conversation is free.

Keep reading