Glossary

Canonical URL

A canonical URL is the address a site declares as the preferred version of a page that can be reached at more than one URL.

A canonical URL is the address a site declares as the preferred version of a page when the same content can be reached at more than one URL. It is set with a link element in the page head, <link rel="canonical" href="https://example.com/guide">, and it tells search engines, social platforms, link preview services and crawlers which address to index, credit and show. Without it, software has to guess which of several near-identical URLs is the real one, and guesses differ between consumers.

Duplicate URLs are far more common than duplicate pages. A single article might be reachable over HTTP and HTTPS, with and without www, with and without a trailing slash, with tracking parameters such as utm_source, with a session ID, through a print view and through a syndicated copy on a partner site. To a person these are one page. To a crawler they are separate addresses that each need fetching, storing and ranking, unless the site says otherwise.

How the canonical tag works

The canonical link element was introduced jointly by Google, Yahoo and Microsoft in 2009 and later written up as RFC 6596. Each duplicate version of a page carries the same tag, pointing to the preferred URL, and the preferred page usually carries a self-referencing canonical pointing to itself. When a search engine finds the tag, it groups the duplicates into a cluster and consolidates signals such as links and relevance onto the canonical address, which becomes the one shown in results.

The tag is a strong hint, not a command. Google treats it as one signal among several and may choose a different canonical if other evidence disagrees: permanent redirects, the URLs listed in a sitemap.xml, the URLs used in internal links and a general preference for HTTPS. When those signals agree with the tag, it is almost always respected. When they conflict, for example a canonical pointing to an address the site never links to, the engine may ignore it.

The same declaration can be sent as an HTTP header, Link: <https://example.com/guide.pdf>; rel="canonical". The header form is the only option for files without an HTML head, such as PDFs, and it is useful when the same document is served from several paths.

Canonical URLs and other signals

A canonical tag is one of several ways to consolidate duplicates, and each fits a different case.

Method

What it does

Best for

301 or 308 redirect

Sends users and crawlers to the preferred URL

Old URLs, HTTP to HTTPS, www to non-www

rel=canonical

Keeps both URLs live but names the preferred one

Tracking parameters, sorted or filtered views, syndicated copies

Sitemap entries

Lists the URLs a site wants indexed

Reinforcing the canonical choice

Robots noindex

Keeps a page out of search results

Pages that should not appear at all

og:url

Names the URL social platforms should credit

Share counts and link previews

Redirects are stronger than canonicals because the duplicate stops existing for visitors, but they are not always possible: a campaign link with utm parameters still needs to load the page so analytics can record the visit. That is the main home of the canonical tag. Combining a canonical with noindex sends mixed messages, since one says the page is a duplicate to be merged and the other says it should be dropped, so the two are best kept apart. The robots.txt file is the wrong tool here entirely; a blocked URL cannot be crawled, so its canonical tag is never read.

Canonical URLs in link previews and sharing

Social platforms and chat apps use the canonical URL, or the Open Graph og:url property that usually matches it, to decide which address a shared link belongs to. Facebook, for instance, aggregates likes and shares for every URL that points to the same og:url, so a link shared with tracking parameters still counts towards the clean address. Preview services do something similar: when they unfurl a URL, they follow redirects to the final address and read the canonical to work out which page they are really looking at.

This matters for caching. A preview cache keyed on the raw URL stores a separate entry for every variant of a popular page; one keyed on the canonical URL stores one. The same logic applies to link unfurling in chat apps, to the og:image that a platform stores for a page and to counts of how often a page is shared. When a page’s meta tags, Open Graph properties and Twitter Cards are being debugged, checking that the canonical and og:url agree is one of the first steps.

Canonical URLs for crawlers, knowledge bases and agents

Anyone who crawls the web for their own use meets the duplicate problem too. A web crawler feeding a search index or a knowledge base can easily ingest the same article three or four times through different URLs. Each copy is chunked and indexed separately, so retrieval returns near-identical passages that crowd out other results, waste context tokens and make citations look repetitive.

Reading the canonical URL during data ingestion is the cheapest fix. Normalise every fetched URL to its canonical form, store the canonical as the document’s identity and skip or merge any page whose canonical you already hold. This is URL-level deduplication, and it catches most duplicates before any content comparison is needed. It also helps incremental indexing: when a page is re-crawled under a different tracking URL, the canonical tells the pipeline it is an update to an existing document, not a new one.

Canonicals improve source attribution as well. An agent that cites a page should link to the clean, stable address, not a session-specific URL that may expire or a syndicated copy that may disappear. Stable canonical URLs also slow the effects of link rot, since they are the addresses sites try hardest to keep working.

Choosing the canonical version

Picking the canonical is a policy decision that should be made once and applied everywhere. Most sites choose HTTPS, one host (with or without www), one trailing slash convention and lower-case paths, then redirect every other form to that pattern. Query parameters need a rule of their own: parameters that change the content, such as a page number or a search term, usually deserve their own canonical, while parameters that only track or reorder, such as utm tags, sort order or session IDs, should canonicalise to the clean URL.

Variants need judgement. A product sold in five colours can share one canonical if the pages are identical apart from a swatch, but separate pages with distinct photos, descriptions and stock levels can each be canonical. Translated pages are a different case again: each language version should be self-canonical and linked to the others with hreflang annotations, since canonicalising every language to English would remove the translations from search. Whatever the rules, write them down, because templates, plugins and campaign tools all generate URLs and each needs to follow the same policy.

Common canonical mistakes

The most damaging mistakes point many pages at one URL. Setting every page of a paginated series to canonicalise to page one tells search engines that pages two onwards are duplicates, so their content may drop out of the index. Templates that hard-code the home page as the canonical do the same at site scale. Both are easy to introduce and hard to spot without a crawl.

Other mistakes are technical. Relative canonical URLs are allowed by the specification but invite errors, so absolute URLs are safer. A canonical that points to a URL which redirects, returns 404 or is itself canonicalised elsewhere creates a chain the engine may not follow. Multiple canonical tags on one page, often one from the CMS and one from a plugin, are usually ignored. A canonical placed in the body instead of the head is ignored too. And a canonical added by client-side JavaScript may not be seen by crawlers that read only the server’s HTML.

Cross-domain canonicals need care. When an article is syndicated, the partner site can set a canonical back to the original, which credits the original publisher. Without that agreement, a large partner site may be chosen as the canonical over the original source.

A worked example

An online retailer finds that search engines index 40,000 URLs for a catalogue of 6,000 products. Each product page is reachable through category paths, sort parameters, colour filters and campaign links, and none carry a canonical tag. The team adds a self-referencing canonical to each product’s clean URL, makes every variant canonicalise to it, lists only the clean URLs in the sitemap and changes internal links to use them. HTTP and non-www addresses get permanent redirects instead.

The team’s own systems benefit as well. Its support assistant had been ingesting product pages from a crawl of the site, and the retrieval index held several copies of most pages. After the change, the ingestion job reads the canonical of every fetched page and keys documents on it, cutting the index to one entry per product. Answers stop quoting the same paragraph three times, and citations link to the address customers see in search.

Where Exabase fits

Exabase returns canonical information where it matters for ingestion and previews. The Link Preview API follows redirects and returns both the final URL and the canonical URL along with the page’s title, description, image and favicon, from one GET /v2/link request. That gives you a clean key for caching previews and for deduplicating links before you store them. Pages are rendered with JavaScript before parsing, results are cached for up to 24 hours and the first 20,000 previews each month are free. The link preview guide and the API reference document the response.

For content you want to keep, save URLs as bookmarks in Resources through the bookmarks endpoint; Exabase fetches each page, stores its metadata, a screenshot and a reader-mode copy, and indexes the content for Deep Search. Extract turns a page into text chunks when you need the full content, and a Worker can keep a knowledge base current by re-checking sources on a schedule. Exabase does not choose canonicals for your own site; that stays with your templates. For comparisons, see the best link preview APIs and the best web scraping APIs.

Frequently asked questions

What is a canonical URL?

A canonical URL is the preferred address for a page that can be reached at several URLs, declared with a canonical link element in the page head or an HTTP Link header.

Should every page have a canonical tag?

Yes, in most cases. A self-referencing canonical on each page makes the preferred address explicit and protects against tracking parameters and other duplicates created by links you do not control.

Is a canonical tag a directive?

No. Search engines treat it as a strong hint. They usually follow it when redirects, sitemaps and internal links agree with it, and may choose another URL when those signals conflict.

What is the difference between a canonical tag and a 301 redirect?

A redirect sends visitors and crawlers to another URL, so the old address stops serving content. A canonical keeps both addresses working but names one as preferred for indexing and credit.

What is the difference between canonical URL and og:url?

The canonical tells search engines which URL to index. og:url tells social platforms which URL to credit for shares. They should normally be the same address. See Open Graph.

Why do canonical URLs matter for RAG and agents?

They let ingestion pipelines recognise the same page under different URLs, so a knowledge base stores one copy, retrieval avoids duplicate passages and citations use stable addresses.

How can I get a page’s canonical URL through an API?

The Exabase Link Preview API returns the final URL after redirects and the page’s canonical URL, along with its title, description, image and favicon.

Related pages: meta tags, Open Graph, redirect chain, URL metadata, link preview, deduplication, sitemap.xml, free Link Preview API, knowledge base solution, best link preview APIs

Cut your token spend and give your agent precise context.

Get started in minutes.

Cut your token spend and give your agent precise context.

Get started in minutes.