/ โ† Meta Tag Fixes / Canonical Tags
In this guide
  1. What the canonical tag does, and what it does not
  2. The canonical findings and what each one means
  3. The right canonical for each type of page
  4. Checking the canonical properly
  5. Where the canonical comes from on common platforms
  6. Awkward cases
  7. The fix, step by step
  8. Keeping canonicals correct
  9. Questions and answers

What the canonical tag does, and what it does not

The canonical tag looks like this and belongs inside <head>:

<link rel="canonical" href="https://www.example.co.uk/garden-furniture/oak-bench/">

It tells search engines: if you find this content at more than one address, this is the address I would like you to index and show. It is useful because the same page is often reachable in several ways, for example with a tracking parameter added by an email campaign, with a sort order added by a filter, or through a second category path in a shop.

Three points about the tag are worth keeping in mind before changing anything:

This guide covers faults in the tag itself. When the tag is fine but the redirects, sitemap and internal links name a different address, the problem is a conflict between signals across the site, which has its own guide: canonical conflicts.

The canonical findings and what each one means

The analyzer reads the canonical from the HTML your server returns and compares it with the address it fetched. These are the faults it most often turns up, roughly in order of how much damage they can do.

FindingWhat you see in the sourceWhy it matters
Canonical points to the home pageEvery page carries href="https://www.example.co.uk/"You are telling search engines every page is a copy of the home page. They will usually ignore it, but some pages may be folded into the home page.
Canonical uses http or the wrong hosthref="http://example.co.uk/about/" on an https www siteNames an address that redirects, so the hint points at something that is not a final page.
Canonical is missingNo rel="canonical" in the headSearch engines choose for themselves between parameter and slash variants. Often fine, sometimes not.
More than one canonicalTwo link rel="canonical" lines, often differentWhen the values disagree, Google may ignore both.
Relative canonicalhref="/about/" or href="about"Allowed, but easy to break on staging copies and with a wrong <base> tag. Absolute is safer.
Canonical keeps parametershref="...?utm_source=newsletter"Each tracked link declares itself the main copy, so the duplicates you meant to merge stay separate.
Slash mismatchPage is /contact/, canonical is /contactPoints at a redirect or at a second copy of the page.
Canonical outside the headTag appears after <body> in the sourceIgnored by Google.
Empty or placeholder valuehref="" or href="{{canonical}}"A template variable failed to fill in. Treated as a broken hint.
๐Ÿ’ก A single wrong canonical is rarely a one-off. If the analyzer flags one product page, check two or three others of the same type; the same template almost certainly wrote the same mistake on all of them.

The right canonical for each type of page

For the great majority of pages the answer is simple: the canonical should be the page's own clean address. That is called a self-referencing canonical. The exceptions are the page types below, and they are where most wrong tags come from.

Ordinary pages, posts and products

Self-referencing, using the address you want in search: https, your chosen host (with or without www), your chosen trailing-slash style, lower case if your platform treats case as different, and no query string.

Paginated lists

Page 2 of a category should name page 2 as its canonical, not page 1. Pointing every page of a series at the first page asks search engines to treat different lists of products or articles as duplicates, and items that only appear on later pages can become harder to discover. Google stopped using rel="prev" and rel="next" as an indexing signal some years ago, so there is no need to add them for Google's sake, though they do no harm.

Filtered and sorted views

A category sorted by price shows the same products as the unsorted category, so its canonical should normally point to the unsorted address. A filter that produces a genuinely different page that people search for, such as a colour or material landing page with its own text, can be self-referencing instead. Decide this per filter, not per page.

Product variants

If each colour or size has its own address but the page content barely changes, point the variants at the main product. If each variant has distinct content, images and search demand, let each one reference itself. Mixing the two approaches in one shop is the usual source of confused reports.

Syndicated and republished articles

When a partner republishes your article with permission, ask them to add a canonical pointing to your original. That is a cross-domain canonical, and it is a legitimate use of the tag. Google has said it may not always honour it for syndicated news, so the original should also be linked from the copy.

Files that are not HTML

A PDF cannot carry a link element, but the server can send the same hint as a header:

Link: <https://www.example.co.uk/guides/care-guide/>; rel="canonical"

This is useful when a downloadable PDF duplicates an HTML page and you want the HTML version to appear in search.

โš ๏ธ Do not use a canonical to point one real page at another unrelated page because you would like it to rank instead. Search engines compare the content, and a canonical between pages that are not near-duplicates is likely to be ignored. Use a redirect if the old page should no longer exist.

Checking the canonical properly

The canonical has to be checked in the raw HTML, because that is the version crawlers read first. The element inspector in browser developer tools shows the page after scripts have run, so a tag added or rewritten by JavaScript will look correct there even when the source is wrong.

From the command line

curl -sL https://www.example.co.uk/garden-furniture/oak-bench/ | grep -io '<link[^>]*canonical[^>]*>'

If this prints two lines, you have two canonicals. If it prints nothing, check whether the tag is being added by a script, and check the response headers too:

curl -sI https://www.example.co.uk/brochure.pdf | grep -i '^link'

Where the tag sits

Open View Source and search for canonical. Note the line number, then search for </head> and <body. If the canonical comes after either, it will not count. A common cause is an element that is not allowed in the head, such as an <img> tracking pixel, a <div> printed by a plugin, or text from an unclosed tag. Browsers and parsers that meet such an element close the head at that point, so every tag after it lands in the body, including a canonical that is correctly placed in your template.

Checking the target

Request the canonical address itself. It should return a 200 status with no redirect, carry the same canonical pointing to itself, and not be blocked by a noindex. A canonical that points at a redirect, a 404 or a noindexed page is a signal clash; the canonical conflicts guide goes through clearing those up across redirects and sitemaps.

Search Console

URL Inspection shows two values: the user-declared canonical, which is what your tag says, and the Google-selected canonical, which is what Google decided. When they differ, the Pages report lists the address under "Duplicate, Google chose different canonical than user". That is not always a fault in your tag, but if the declared value is wrong, fix the tag first and then look at the other signals.

Where the canonical comes from on common platforms

Very few sites type canonicals by hand. The tag is written by a template or a plugin, so the fix happens there.

PlatformWhat writes the tagWhere to change it
WordPressWordPress core prints a canonical on single posts and pages; SEO plugins such as Yoast, Rank Math and SEOPress replace it with their own on every page typeThe plugin's per-post field for an override; the plugin's settings or filters for rules. See meta tags in WordPress.
ShopifyThe theme, normally {{ canonical_url }} in theme.liquidThe theme code. Check apps and custom snippets are not adding a second tag.
Next.js (App Router)alternates.canonical in the Metadata API, resolved against metadataBaselayout or page files, or generateMetadata for dynamic routes.
Static sites and generatorsA layout partialBuild the value from the site's base URL setting plus the page path, never from the request.
Custom PHP or other server codeOften built from the incoming requestBuild from a fixed base URL and the normalised path, with the query string removed.

The home page mistake

The most damaging template fault is a canonical hard-coded in a shared header file. Someone adds <link rel="canonical" href="https://www.example.co.uk/"> to fix the home page, forgetting that the same header is used by every page. Search the theme or layout files for the literal string rel="canonical"; there should be exactly one place it is written, and it should use a variable.

Building the value safely

In server code, never echo the requested address straight into the tag. That copies tracking parameters, mixed case and odd paths into the canonical, and on a badly configured server it can let anyone put their own host name into your tag. Use a configured base address and a cleaned path. A simple pattern in PHP:

<?php
$base = 'https://www.example.co.uk';
$path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
$path = rtrim($path, '/') . '/';
?>
<link rel="canonical" href="<?= htmlspecialchars($base . $path) ?>">

Adjust the slash rule to your own site; the point is that the host and protocol are fixed and the query string is dropped.

Awkward cases

The fix, step by step

Step 1

Read the canonical the server actually sends

Run the Meta Tag Analyzer on one page of each type: the home page, a normal content page, a category, a product or article, and page two of a list. For each, also open View Source or use curl and search for canonical. Write down the value, how many times it appears and whether it sits before the closing head. Ignore the element inspector for this, because scripts may have changed what it shows.

Step 2

Decide the correct target for each page type

Make a short table with one row per page type and the address its canonical should name. Most rows will say the page's own clean address. Mark the exceptions clearly: sorted views pointing to the unsorted list, thin variants pointing to the main product, syndicated copies pointing to the original, and print or AMP copies pointing to the normal page. Pagination pages reference themselves. This table becomes the rule you implement.

Step 3

Write the tag as one absolute https URL

Change the template so the canonical is built from a fixed base address, including https and your chosen host, plus the cleaned path of the page. Strip query strings such as utm_source, gclid and sort parameters, apply your trailing-slash rule and lower-case the path if your server is case sensitive. Never build the value by echoing the requested address, and make sure the value is HTML-escaped inside the attribute.

Step 4

Remove extra canonicals and move stray ones into the head

Search the theme, layout files, plugins and tag manager for anything else printing rel="canonical" and switch off every source except one. On WordPress this usually means letting the SEO plugin own the tag. Then look for elements that close the head early, such as tracking pixels, plugin output or stray text before the canonical, and move them into the body so the canonical sits inside a valid head.

Step 5

Correct the template rule, not single pages

Apply the fix where the tag is generated so every page of that type is corrected at once. Remove any hard-coded canonical from shared headers, which is how whole sites end up pointing at the home page. Keep per-page overrides for genuine exceptions only, and note them somewhere the team can see. Clear page and CDN caches afterwards, otherwise the analyzer and crawlers will keep seeing the old tag for a while.

Step 6

Check Google agrees with your choice

Re-run the analyzer on the same sample of pages and confirm there is exactly one canonical per page, in the head, with the expected absolute value. Request each canonical address and confirm it returns 200 with no redirect. In Search Console, inspect a few key pages and compare the user-declared canonical with the Google-selected one. Google will update its choice as it recrawls, which can take days or weeks.

Keeping canonicals correct

Questions and answers

1. Does every page need a canonical tag?

It is not required, and search engines will choose a canonical for themselves when none is given. But a self-referencing canonical on every indexable page is cheap insurance. It stops tracking parameters, sort orders and slash variants being treated as separate pages, and it gives you a clear statement to compare against when Search Console reports that Google chose a different address. The important thing is that the tag is correct; a wrong canonical is worse than none.

2. Should the canonical be an absolute or relative URL?

Google accepts relative canonicals, but absolute ones are strongly preferred. A relative value such as a bare path depends on the address it is read from, so a copy of the page on a staging host or reached through a different protocol will declare that copy as canonical. A base tag in the head can also change how a relative value is resolved. Writing the full https address, including your chosen host, removes that ambiguity entirely and makes the tag easier to audit.

3. Why is my canonical being ignored by Google?

Usually because other signals disagree with it or the tag is not valid. Check that there is only one canonical, that it is inside the head rather than pushed into the body, that the target returns 200 without redirecting and is not noindexed, and that the two pages really are near-duplicates. Then check internal links and the sitemap point to the same address. Google treats the tag as a strong hint, but it will choose differently if most of your site says otherwise.

4. Should page 2 of a category point its canonical at page 1?

No. Each page in a paginated series shows different items, so it is not a duplicate of page 1, and pointing it there may make products or articles that only appear deeper in the list harder for search engines to find. Give each paginated page a canonical to itself, keep normal links between the pages so they can be crawled, and make sure page 1 of the series uses the clean category address rather than one with a page parameter added.

5. Is it a problem if the canonical points to a URL with a trailing slash and the page has none?

Yes, if the two addresses are different on your server. With and without a trailing slash are separate URLs, so a mismatch means the page names a different address, which is often a redirect. Choose one style, make the server redirect the other, and generate the canonical with the same rule. If both addresses currently load the same page without redirecting, fix the redirect as well, because the tag alone is only a hint.

6. Can I use a canonical tag instead of a 301 redirect?

Only when both addresses need to stay available to visitors. A canonical keeps the duplicate page usable, which suits tracking links, sorted views and printer-friendly copies. When a page has moved or been replaced and nobody needs the old address, a 301 redirect is the stronger and clearer signal, because it moves visitors and search engines alike. Using a canonical in place of a redirect for moved content leaves two pages live and relies on search engines accepting the hint.

7. What happens if a page has two different canonical tags?

When a page declares two different canonicals, Google has said it may ignore both and choose one itself, so your preference is lost. The usual causes are a theme and an SEO plugin each printing a tag, a hard-coded tag left in a header file, or a tag manager adding another. Find every source by searching the templates and plugin settings, keep the one that generates the correct value, and switch off the others rather than trying to make them match.

Check your canonical tags

The Meta Tag Analyzer reads the head of your page and checks whether the canonical is correct, alongside the title, description, robots directives, viewport, Open Graph and X card tags.

Open Meta Tag Fixes โ†’
๐Ÿ’ฌ Got a problem?
Related Guides: All Meta Tag Fixes  ·  Canonical Conflicts  ·  www Canonicalisation  ·  Meta Analyzer Guide  ·  Learning Hub

About aiwebpageseo

aiwebpageseo.com is a data-driven SEO and AEO (Answer Engine Optimisation) platform providing a free suite of technical SEO tools. Rather than relying on AI-theorised assumptions, the platform analyses live URL performance, delivering objective diagnostics, page speed metrics, CLS debugging, and site crawl data alongside actionable technical tutorials.