Alla artiklar
14 november 2026

Canonical URLs explained: consolidating duplicate pages, 2026

A canonical URL is the one address you want Google to treat as the main version of a page. Here is how to set it and which mistakes to avoid.

Team around a shared table with laptops and papers, comparing pages to choose one main version

What is a canonical URL?

A canonical URL is the single address you want search engines to treat as the main version of a page that can be reached at several URLs. You declare it so that links and other signals pile up on one page instead of being split across copies.

As of November 2026, Google's documentation describes the benefit in four parts. A canonical lets you control which URL people see in search results, consolidate signals for similar or duplicate pages, get clearer metrics for one piece of content, and avoid spending crawl time on duplicate versions instead of new or updated pages.

This guide covers where duplicates come from, the three ways to signal a canonical, the rules for a valid tag, five common mistakes, and a Next.js example.

Why duplicate pages happen

Nobody writes duplicates on purpose. They appear when the same content answers at more than one address. Google's guide names the usual causes: tracking parameters such as gclid, and variants of one page that differ by protocol, host or language.

In practice that means the same article can answer at http:// and https://, with and without www, and with a campaign parameter appended. To a person these are one page. To a crawler they are several URLs, and each one collects its own links.

Duplicate pages split the signals search engines have for them, links included. A canonical tells Google which URL you prefer, so links to the variants count toward that one page.

The three ways to signal a canonical

Google ranks three methods by how strongly they influence the choice. You can combine them, which raises the odds that your preferred URL is the one shown.

Checklist diagram with three items: Redirect (strong), rel="canonical" link (strong) and Sitemap entry (weak)
Checklist: The three ways to signal a canonical.
  • Redirect (strong): use it when you are retiring a duplicate for good.
  • rel="canonical" link (strong): use it when both URLs must stay reachable.
  • Sitemap entry (weak): use it as a low-effort hint across a large site.

Google calls a redirect "a strong signal that the target of the redirect should become canonical." Use a permanent redirect when you are retiring a duplicate page, and prefer server-side HTTP redirects, which work fastest.

The rel="canonical" annotation is also "a strong signal that the specified URL should become canonical." You place a <link> element in the <head> of the duplicate page that points to the preferred URL. For non-HTML files such as PDFs, you can send the same signal as a rel="canonical" HTTP header. Pick the HTML element or the header, not both, because using both is more error-prone.

A sitemap is "a weak signal." Listing your preferred URLs is easy to maintain on a large site, but Google still decides which pages are duplicates.

All three are signals, not commands. If you specify nothing, Google will identify which version of the URL is objectively the best version to show to users in Search. Your job is to make your signals agree so that choice matches yours.

Google also prefers HTTPS pages as canonical unless there is a problem, such as an invalid certificate or an HTTPS page that redirects back to HTTP. Avoid listing HTTP URLs in sitemaps.

Rules for a valid rel=canonical tag

Most failures trace back to a handful of format rules.

  • Use absolute URLs. Write https://example.com/page, not /page. Google says relative paths can cause problems, such as pointing at a crawlable testing site.
  • Put it in the head. The link element only counts inside <head>.
  • Use one tag per page. When more than one is specified, all the rel=canonical links are ignored.
  • Add a self-referencing canonical. Include the tag on the canonical page itself, so the preferred URL states its own status.
  • Link to the canonical internally. Point your own links at the canonical URL, not at duplicates.
  • Keep JavaScript out of it. If you render on the client, put the canonical in the HTML source. If you cannot, set it with JavaScript and make sure your scripts do not change it afterward.
  • Stay consistent. Do not name one URL in the sitemap and a different one in the link element for the same page.

Five canonical mistakes

Google's Search Central blog published a short list in 2013, and it still matches what audits find.

  1. Pointing paginated pages at page 1. Page 2 and later carry different content, so they are not duplicates. The risk is that the later pages are not indexed at all.
  2. Writing the URL without a scheme. A canonical written as a bare domain and path can be read as a relative path. In Google's words, "our algorithms may ignore the specified rel=canonical."
  3. Declaring it twice or by accident. A page template copied without editing can point every page at the template author's site, and an SEO plugin can insert a default canonical you never see. Check the whole <head>, because tags can sit far apart.
  4. Canonicalizing a category page to a featured article. The advice is to avoid adding a rel=canonical from a category or landing page to a featured article, or the category page can disappear from results.
  5. Placing the tag in the body. A rel=canonical in the <body> is disregarded. It belongs in the head.

Before you ship, confirm that each duplicate shares most of its main text with the canonical page, that each page has one canonical in its head, and that the target is a live URL with good content.

What not to use for canonicalization

Three tools look like fixes. They aren't.

  • robots.txt. Google states that it "may still index URLs that are disallowed in robots.txt without their content."
  • noindex. It blocks the page from Search entirely, so it consolidates nothing. rel=canonical is the preferred solution.
  • The URL removal tool. It hides all versions of a URL from Search.

Also avoid URL fragments as canonicals, since Google generally does not support them.

Canonicals and language versions

Do not use rel=canonical to point language versions of a page at each other. Google does not use canonical annotations that carry hreflang, lang, media or type attributes for canonicalization. For language and country variants, use rel="alternate" with hreflang, and choose a canonical in the same language as the page. Google also favors URLs that reference each other reciprocally through hreflang. Our walkthrough of hreflang and canonicals for a bilingual Next.js site shows how the two fit together.

Setting a canonical in Next.js

In the App Router, set metadataBase once in the root layout and alternates.canonical per page. The Next.js documentation shows this configuration producing <link rel="canonical" href="https://acme.com" /> in the head:

Node map diagram with three parts: titles, canonicals and Open Graph
Node map: Setting a canonical in Next.js.
export const metadata = {
  metadataBase: new URL('https://acme.com'),
  alternates: {
    canonical: '/',
  },
}

If a field gives an absolute URL, metadataBase is ignored. A relative path without metadataBase causes a build error, which is a useful guard against the relative-URL mistake above. Metadata from nested segments is shallowly merged, so a segment that defines alternates replaces the parent's value. For the rest of the metadata API, see Next.js generateMetadata: titles, canonicals and Open Graph.

Conclusion

Pick one preferred URL per page, state it with a permanent redirect where a duplicate can go away and with an absolute, single, self-referencing rel="canonical" in the head where both URLs must stay. Keep your sitemap, internal links and tags pointing at the same address, because Google treats all of it as signals and rewards agreement.

Canonical checks belong in any technical SEO review, and they are one line item in our AEO audit checklist. If you want a second pair of eyes on a site, our SEO and AEO service covers this kind of audit.

Frequently asked questions

What is a canonical URL?

The canonical URL is the one address you want search engines to treat as the main version of a page when several URLs show the same or very similar content. Google uses it to consolidate signals such as links and to choose which URL appears in results.

Is rel=canonical a command?

No. Google describes redirects and rel=canonical as strong signals and sitemaps as a weak one. Google still decides which URL to show, so your signals should agree with each other.

Should every page have a self-referencing canonical?

Yes, that is Google's guidance: include a rel=canonical link on the canonical page itself. It states your preferred URL, including when tracking parameters get appended to a link.

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

No. Google may still index URLs disallowed in robots.txt without their content, and noindex removes the page from Search entirely instead of consolidating it.