Canonical tag errors: what they mean and how to fix them
A canonical tag tells search engines which URL of a page is the main one. Errors appear when the tag is missing, appears twice, is relative, uses http, or points to a redirect, an error page or a noindex page. Search engines may then ignore it and pick another URL, which splits signals between duplicates. Give every page that can be indexed an absolute, self-referencing https canonical.
How the problem happens
Canonical tags usually break after a migration, a plugin change or a template edit. Two plugins each print a tag, a staging host leaks into the link, or the tag still points to an old address that now redirects.
Why canonical errors can cost rankings and citations
One page often answers on several addresses: with and without www, with a tracking parameter, with a trailing slash, in a print version. To a crawler each address is a separate document. The canonical tag is your vote for the one address that should represent them all. Google and Bing treat it as a strong hint, not a command, so a vote that is wrong, doubled or contradicted by other signals is simply overruled, and the engine picks a canonical itself.
The cost shows up in three ways. Links and engagement can be split between the duplicates, so none of them gets the full weight. Crawl time is spent on copies instead of new content. And the address that ends up in results may be the one you did not choose, such as a parameter URL or a staging host. AI search systems that retrieve pages from a search index may inherit the same choice: when they cite a page they often quote the address the index holds, so a messy canonical can influence which URL, if any, is shown as the source of an answer. Systems differ and nothing is guaranteed.
How to diagnose canonical problems by hand
Start with the raw response, not the browser view. Run curl -s -I https://example.com/page to read the headers and curl -s https://example.com/page to read the source, then search for rel="canonical". A page should return exactly one tag, inside the head, with a full https address. Open that address in turn: it must answer 200 without a redirect and must not carry a noindex directive.
Then compare against what the engine decided. In Google Search Console the URL Inspection tool shows both the canonical you declared and the one Google selected. When they differ, look for signals that outweigh the tag: internal links and the sitemap pointing to a different version, a redirect, or content that is not truly identical. Typical symptoms are pages reported as duplicate without a user-selected canonical, an old domain still appearing in results after a migration, or a parameter address outranking the clean one.
A last manual check is the template: view the source of a category page, a paginated page, a translated page and a PDF. Each context tends to have its own bug, and a fix made for blog posts rarely reaches them.
How to fix canonical tags in code, server and CMS
Print the tag in one place only. In a CMS that is the SEO plugin, with the theme's own output disabled. In a framework it is the layout or metadata function. Build the value from one setting for the public origin, so that http, staging and www can never leak into it. Always write an absolute https address; a relative value such as /pricing is resolved against whatever host answered the request.
Point the canonical at the final address: if /old redirects to /new, every canonical that points to /old must say /new, and the target must be a page that can be indexed. A canonical to a redirect, an error page or a noindex page contradicts itself and the engine is likely to ignore it. Pages that really are duplicates, such as a print version, may point their canonical to the main page; every normal page points its canonical to itself.
Files that cannot hold a tag, such as PDFs, can send the same information in an HTTP header. If you send both a header and a tag, make them identical. The example shows both forms.
<head>
<link rel="canonical" href="https://example.com/pricing">
</head>
# for a PDF or another non-HTML file (Nginx)
location ~* \.pdf$ {
add_header Link '<https://example.com/files/guide.pdf>; rel="canonical"';
}How RankDossier detects canonical errors
RankDossier reads the canonical from the raw HTML and from the response headers of every crawled page, then follows the address it finds. The checks in this family test whether the tag is missing, appears more than once with different targets, is relative, points to http, to another host or to another language, and whether the target is an error page, a redirect or a noindex page. A separate check compares the HTML tag with the HTTP header, and another lists pages whose canonical points elsewhere, so you can confirm that is intended.
Each finding in the report names the page, shows the value that was read as evidence and gives the fix from the catalog. Use the Indexability checker to test a single page, and read the guide on noindex, canonical and multilingual sites for how the three signals interact. After a domain change, the site migration guide lists which canonical tags to re-check, and the guide to pages that are not indexed explains what to do when Google chooses a different canonical than you did.
Wrong and right
Wrong
<link rel="canonical" href="/pricing">
<link rel="canonical" href="http://old.example.com/pricing">
Right
<link rel="canonical" href="https://example.com/pricing">
How to fix it
WordPress
Let your SEO plugin control canonical tags, set the preferred address in Settings, General, and remove the tag that the theme or a second plugin prints.
Next.js
Set alternates.canonical in the page metadata and define metadataBase once in the root layout, so every canonical becomes a full https address.
export const metadata = {
metadataBase: new URL('https://example.com'),
alternates: { canonical: '/pricing' },
};
Nginx
Redirect every other host and the http version to the preferred address, so only one version can return a page. For files such as PDFs, send the canonical as a Link header.
server {
listen 443 ssl;
server_name www.example.com;
return 301 https://example.com$request_uri;
}
Check codes in this family
These checks belong to this family. Each code appears in the audit report with its own explanation and fix.
CANONICAL_MISSINGCanonical is missingCANONICAL_MULTIPLEMultiple canonical tagsCANONICAL_RELATIVERelative canonicalCANONICAL_TO_ERRORCanonical points to an error pageCANONICAL_TO_REDIRECTCanonical points to a redirectCANONICAL_TO_NOINDEXCanonical points to a noindex pageCANONICAL_OFFHOSTCanonical points to another hostCANONICAL_HTTPCanonical points to http://CANONICAL_HEADER_CONFLICTHTML and HTTP header canonical tags differCANONICAL_NON_SELFPages whose canonical points elsewhereCANONICAL_LANG_MISMATCHCanonical points to another language
Related check families
Read the full guide Common indexing and canonical tag mistakes on multilingual sites for the wider picture. Test one page for free with the Indexability checker.
Check your own site
Enter a domain – the free pre-check reads up to 10 pages and shows how many types of problems it finds. You pay only if you want the full report.
Start the free pre-check