# What Is a Canonical URL (rel=canonical) in SEO?

> What a canonical URL is, how Google uses it to pick the address of a product page with several URLs and how to check which one it chose in your store.

URL: https://clione.ai/glossary/canonical-url/
Lang: en

Here "canonical" is not Canonical, the company that publishes Ubuntu, which takes up a good part of the first page when you search the word alone. It is the tag a page uses to say which URL should count when its content can be opened from several addresses. In a store that happens daily: **the same product can have three or four URLs, and if you do not say which is the right one, the search engine picks it**. That [product page](/glossary/product-page/)'s signals get split across addresses, and the one that shows up in the results may not be the one you link in your campaigns.

## How it works

The IETF defined the canonical relation in April 2012, in RFC 6596, authored by M. Ohye and J. Kupke. It is used to point to the preferred URL among a set of resources that serve the same content in duplicate. The URL it points to **has to be a duplicate of the page or a superset of its content**, not a different page. And the text warns of three mistakes that make content get lost: pointing to a URL that redirects, to one that returns an error or to the first page of a paginated series.[^rfc6596]

Google calls the process of choosing the representative URL for a piece of content canonicalization. The causes of duplication it lists are the ones in any store: regional variants, mobile and desktop versions, `http` versus `https`, site features such as sorting and filtering, and test versions indexed by accident.[^google-canonicalization] Having some [duplicate content](/glossary/duplicate-content/) on a site is normal and **does not violate its spam policies**.[^google-canonicalization]

To say which one you prefer, Google accepts several methods and gives them different weights:[^google-consolidate]

| Method                               | How it is declared                           | Weight for Google |
| ------------------------------------ | -------------------------------------------- | ----------------- |
| Redirect                             | The duplicate URL redirects to the right one | Strong signal     |
| `rel="canonical"` in the HTML        | A `<link>` element in the `<head>`           | Strong signal     |
| `rel="canonical"` in the HTTP header | A `Link` header in the response              | Strong signal     |
| Sitemap                              | Include only the right URL in the sitemap    | Weak signal       |

In addition, Google prefers `https` to `http` and takes [hreflang](/glossary/hreflang/) groups into account.[^google-consolidate] The versions of a page in different languages only count as duplicates if the main content is in the same language.[^google-canonicalization]

What is most worth remembering is the limit: you can state your preference, but Google may choose another page as the canonical for several reasons. In its words, **specifying a canonical is a hint, not a rule**.[^google-canonicalization] For the hint to carry weight, Google asks for absolute URLs rather than relative ones, for the right URL to declare itself canonical, for the `<link>` element to go only in the `<head>`, for the different methods to point at the same URL and, on sites that depend on JavaScript, for the canonical to be in the source HTML instead of being injected afterward.[^google-consolidate]

## In a store

A **fictitious example**: a store sells a travel tripod, and the same product can be opened from four addresses.

| URL                                                 | Where it comes from        | Canonical it should declare   |
| --------------------------------------------------- | -------------------------- | ----------------------------- |
| `/products/travel-tripod-t20`                       | The product's own URL      | Itself                        |
| `/collections/tripods/products/travel-tripod-t20`   | The link from a collection | `/products/travel-tripod-t20` |
| `/products/travel-tripod-t20?variant=4471`          | A variant selection        | `/products/travel-tripod-t20` |
| `/products/travel-tripod-t20?utm_source=newsletter` | A campaign link            | `/products/travel-tripod-t20` |

In the HTML of all four, the line that matters is the same:

```html
<head>
  <link rel="canonical" href="https://store.example/products/travel-tripod-t20" />
</head>
```

For a file that is not HTML, such as the spec sheet in PDF, the same indication goes in the response header: `Link: <https://store.example/products/travel-tripod-t20>; rel="canonical"`.

If your store is on Shopify, the platform **adds canonical URLs to pages automatically** to keep duplicate content from showing up in the results.[^shopify-seo] In the theme, the line comes from the [Liquid](/glossary/shopify-liquid/) global object `canonical_url`, inside the `<head>`: `<link rel="canonical" href="{{ canonical_url }}" />`.[^shopify-theme-metadata] That covers the normal case. What it does not cover is the inconsistency you add yourself: an external sitemap that lists the collection URLs, a campaign that always links with parameters or an app that writes a second canonical.


**Blocking the duplicate URL or marking it `noindex` is not canonicalizing.** Google expressly asks that you not use `robots.txt`, the URL removal tool or `noindex` to choose the canonical.[^google-consolidate] Blocking with [`robots.txt`](/glossary/robots-txt/) stops the [crawler](/glossary/web-crawler/) from reading that page's canonical, and a [`noindex`](/glossary/noindex/) tells it not to index the page, which is a different instruction. What works is a consistent canonical or, if the duplicate URL does not have to exist for anyone, a redirect.


## How to check it

1. **Open the source code of a product page** (Ctrl+U in Chrome, not the inspector) and search for `rel="canonical"`. There should be exactly one, inside the `<head>`, with an absolute URL that starts with `https://`.[^google-consolidate]
2. **Open the same product page from other addresses**: from a collection, with a variant selected and with a campaign parameter. All four have to declare the same canonical.
3. **Review your [XML sitemap](/glossary/xml-sitemap/)**: it has to list the canonical URLs and not their variants, because the sitemap is also a signal, though a weak one.[^google-consolidate]
4. **Run the URL through [Search Console](/glossary/google-search-console/)'s URL Inspection** and compare the canonical you declared with the one Google selected. That data is only in the indexed data: **the live test cannot predict which URL will be the canonical**, and the value can lag the index by a few hours.[^gsc-url-inspection]
5. **If they do not match, look for the signal that contradicts** your canonical: a redirect that points to another URL, a sitemap with variants, a second tag or an hreflang that points to another address.

## Related concept: 301 redirect

A [301 redirect](/glossary/301-redirect/) and a canonical look for the same thing, for a single URL to count, and Google treats both as strong signals.[^google-consolidate] The difference is in what the person sees. With the redirect, whoever opens the old URL ends up on the new one and the old one stops existing in practice. With the canonical, both URLs stay open and only which one counts for the search engine changes. That is why in a store they split the work: **the redirect for what should no longer exist** (a product that changed URL, a merged category) and **the canonical for what has to stay open** (a variant, a product page seen from a collection, a campaign link). A canonical that points to a URL that redirects mixes the two and, according to RFC 6596, is one of the mistakes that make content get lost.[^rfc6596]

The canonical decides which URL gets into the index, so the next step is to understand [indexing](/glossary/indexing/); this topic's [reading path](/learn/crawling-and-indexing/) puts the rest of the terms in order.
