
A canonical tag is an HTML link element that tells search engines which URL you prefer for a page when duplicate or very similar versions exist. The canonical URL is the address chosen to represent that content. Your declared preference and the version a search engine selects can differ.
To check a canonical properly, answer three questions: do these URLs contain equivalent content, what does the live page declare, and which version has the search engine selected? A valid-looking tag answers only the second question.
This guide takes you from a simple canonical tag example to implementation, platform settings and a repair process. You will also learn when to use a redirect, when pages should stay separate and how to avoid confusing canonical tags with hreflang.
What are canonical URLs?
A canonical URL represents a piece of content that may be available through several addresses. For example, an article might load at both of these illustrative URLs:
- https://example.com/guides/site-audit
- https://example.com/guides/site-audit?utm_source=newsletter
If both show the same article, the clean address is a reasonable preferred version. The campaign parameter may still be useful for measuring a visit; it does not necessarily create a new article.
Canonicalization, also spelled canonicalisation, is the process of selecting a representative URL from equivalent versions. Google's explanation of canonicalization distinguishes this selection from the preference a site declares. Ordinary duplication is not automatically a spam-policy violation, but it can complicate discovery and reporting.
Keep the terminology precise: “user-declared canonical” describes the site's signal; “Google-selected canonical” describes Google's indexing decision. A page can declare itself correctly without that alone proving it has been indexed.

What is a canonical tag?
A canonical tag is a link element containing the relationship rel="canonical" and an href value identifying the preferred URL. For an HTML page, place it inside the document head.
<head>
<link rel="canonical"
href="https://example.com/guides/site-audit">
</head>The tag is commonly called a “canonical meta tag,” although its HTML element is link, not meta. When reviewing code, look for the link relationship rather than a meta tag named canonical.
A self-referencing canonical points to the preferred address of the page you are viewing. In this example, the clean article declares the clean address. A genuinely duplicate parameter version can declare that same destination.
Use an absolute URL, keep one consistent preference and check the rendered result. Google's canonical declaration guidance explains HTML link annotations, HTTP headers and their limitations. These annotations express a preference rather than forcing a particular indexing outcome.

First decide whether the pages are actually duplicates
Do not start by copying a canonical URL into every related page. Start by comparing what the pages help a visitor do.
- Same article, tracking parameter added: usually an equivalent-content candidate.
- Old and new addresses for one permanently moved article: consider a redirect.
- A product comparison and a separate installation tutorial: different tasks, even if they mention the same product.
- A listing's first and second pages: potentially different items, requiring their own treatment.
- Fully translated articles: language alternatives, not automatically duplicates of the English article.
A shared keyword is not evidence of duplication. A checklist, definition and buying page can legitimately discuss one topic while serving different needs. If the distinction is unclear, compare the reader tasks using the keyword intent analysis guide before making a consolidation decision.
Write down the preferred outcome: keep both versions accessible, retire an address, preserve distinct pages or exclude a page from search. That outcome determines the mechanism.
Canonical tag, redirect, noindex or robots.txt?
These controls solve different problems. Choose the one that matches the intended visitor experience and indexing goal.
| Intended outcome | Mechanism to investigate | What visitors experience |
|---|---|---|
| Keep equivalent URLs accessible and express a preferred version | Canonical declaration | The address they opened can remain visible |
| Permanently move an old address to its replacement | 301 or 308 redirect | The browser moves to the destination |
| Exclude a publicly accessible page from search | Appropriate noindex directive | The page can remain available directly |
| Manage whether crawlers fetch a URL pattern | Robots.txt crawl rules | Visitor access is a separate matter |
Use a canonical when equivalent versions must remain accessible
For example, an email campaign may use a tracked article address while your editorial links use the clean version. A canonical can express which address should represent that article without removing the tracked URL.
Do not expect the browser address to change. Test the source and destination separately, and retain campaign measurements according to your analytics setup.
Use a permanent redirect when an address has moved
If an old article address should stop serving its own page, send visitors to the matching new destination. Google documents 301 and 308 permanent redirects for lasting moves.
Update the new page's declaration and controlled links around the final destination. Avoid sending an old article to a generic homepage when a matching replacement exists. The blog URL slug guide explains the decision to change a published address and the visitor checks that follow.
Use noindex when the goal is exclusion
A noindex directive asks a search engine not to include a page in its index. It is not a shortcut for telling it which duplicate should inherit a preferred role. Choose an exclusion policy separately from a consolidation policy.
Google's robots meta tag documentation explains the directive. Crawlers must be able to retrieve the page to see an HTML noindex instruction. Blocking access and expecting the crawler to read a hidden instruction are incompatible expectations.
Use robots.txt to manage crawling, not declare a canonical
A robots.txt disallow rule controls fetching; it does not identify the preferred equivalent page. Google's robots.txt introduction separates crawler access from exclusion from search. If a duplicate must be crawled to expose its canonical, blocking it can frustrate that review. Decide the crawl policy deliberately instead of treating several controls as interchangeable fixes.
How to check a canonical URL before editing it
Use a small evidence record. For each affected page, save the requested URL, final URL, canonical declaration, response status, content match and observation date. Add a search engine's selected canonical only when that report is actually available.
1. Compare the requested address with the final address
Open the page and note whether it redirects. The initial address and the one ultimately displayed may differ. Inspect the final page's primary content, not just its title.
For a normal indexable article, investigate a canonical destination that errors, requires authentication or displays unrelated material. Do not declare success merely because some URL returns a page.
2. Read the HTML head and response headers
Use View Page Source and search for rel="canonical". Confirm the declaration is in the head and count the declarations. If a server also sends an HTTP Link header, compare its destination with the HTML value.
Record the exact protocol, hostname, path, capitalization and slash convention. A staging domain in a production tag is an actionable observation. A longer or shorter slug, by itself, is not a canonicalization diagnosis.
For non-HTML resources, such as a downloadable document, an HTTP Link header may be the appropriate declaration. A conceptual response header looks like this:
Link: <https://example.com/resources/audit.pdf>; rel="canonical"This is a header example, not an instruction to paste the line into an HTML body. Ask the developer managing the response to verify the implementation.
3. Compare source HTML with the rendered page
If JavaScript or a head-management library changes metadata, inspect the rendered head too. Check whether a second declaration appears or the destination changes after rendering.
Google's JavaScript canonical guidance recommends a clear, consistent value. It allows JavaScript-generated declarations in appropriate cases, but warns against changing an existing HTML canonical to a conflicting URL.
You do not need to introduce dynamic rendering simply because a site uses JavaScript. Diagnose the actual source-versus-rendered difference and correct the component responsible for it.
4. Compare internal links and the existing sitemap
Follow an ordinary internal link to the article and read its destination. Compare that address with the canonical and the entry in the current sitemap file. Inspecting a sitemap is a read-only check; this workflow does not require resubmitting it.
Google's sitemap guidance on preferred URLs explains why a sitemap should reflect the versions you want represented. A sitemap entry is not proof of indexing.
After a correction, use the internal-link audit workflow to find controlled links that still lead through duplicate or retired addresses. Preserve useful tracking where it is genuinely needed; avoid adding campaign parameters to ordinary editorial links without a reason.
5. Compare the indexed report in Search Console
In a property you are authorized to inspect, open the URL Inspection report and review the user-declared and Google-selected canonical fields when available. Record the report context and relevant crawl timing.
Google's URL Inspection documentation explains that selected-canonical information comes from indexing. A successful live fetch cannot establish which canonical Google will ultimately select.
Separate the observations in your notes: “the current HTML declares A” and “the available indexed report selected B.” If the report reflects an older state, the disagreement does not establish that a repair made today has failed. This review uses reports and inspections, not an indexing-request button.
How to add or change canonical tags on your platform
Inspect the current output before adding another mechanism. A theme, SEO module, application route or server configuration may already control the value. Two settings that look harmless in separate screens can produce conflicting output together.
WordPress: inspect core output and the active SEO plugin
WordPress has a core rel_canonical function for singular queries such as individual posts. A plugin is not inherently required for WordPress to output any canonical tag. Actual output depends on the active theme, plugins and page context.
If Yoast SEO controls the field, its official canonical setting instructions describe opening the relevant content, expanding Advanced and entering a full preferred URL when an override is needed. Save the change, then inspect the public HTML again.
For an ordinary post with a correct automatic value, an override may be unnecessary. If you use another SEO plugin, consult that plugin's current instructions. Avoid enabling multiple canonical-output systems simply to make an audit warning disappear.

Magento 2: review category and product configuration separately
For Magento 2 canonical URL settings, inspect Stores, Settings, Configuration, then Catalog and its Search Engine Optimization section in the relevant deployment. Adobe documents separate controls for canonical link meta tags on categories and products in its Commerce metadata guidance.
Check the store-view scope and inheritance before changing a value. Then inspect a representative product URL, a category-context variant and a category page. A product's preferred address and a category's preferred address need not follow the same route pattern.
This is not a blanket instruction to copy one category setting across every store. Confirm which URLs contain equivalent product content and preserve separately useful category pages.
Shopify: check the theme's generated canonical
Shopify exposes a canonical_url Liquid object for the current page. Theme code can use that object in the document head.
Before editing a theme, inspect whether its layout already emits a canonical. Check representative product, collection and article URLs after any change. Adding an app or a second hard-coded tag without reviewing existing output can create a new problem rather than solve the original one.
Drupal: review defaults, entity overrides and rendered output
Drupal's Metatag module supports canonical URL metadata, global defaults and entity-level overrides. Review the installed module version, content-type configuration and any page-specific override.
Test the public route rather than assuming a token resolves to the intended address. A global setting can affect many nodes; a single exceptional page may need a narrower correction. Drupal canonical URL SEO features are useful only when the generated destination is appropriate for that page.
How to add a canonical tag in PHP
For a custom PHP template, determine the preferred URL from trusted application routing or an explicit page configuration, then output it safely in the head. This example demonstrates one page only:
<?php
$canonicalUrl = 'https://example.com/guides/site-audit';
?>
<link rel="canonical" href="<?= htmlspecialchars(
$canonicalUrl, ENT_QUOTES, 'UTF-8'
) ?>">The link belongs inside the template's existing head element. Replace the illustrative address with the correct configured destination. Do not deploy this as a site-wide fixed URL: every unrelated article would then point at one page.
PHP's htmlspecialchars documentation describes the escaping function used here. Escaping protects the HTML attribute; it does not decide which address should be canonical. Avoid building the preferred hostname from arbitrary request input. After deployment, verify actual route behavior and check that another template or header does not produce a different declaration.
Common canonicalization issues and how to investigate them
Use the symptom to choose the next check. A missing tag, an unsuitable target and Google's selection of another version are different observations and need different evidence.
Missing canonical tag
First confirm it is absent from both the HTML and any applicable response header. Decide whether the page has duplicates and whether its intended primary address is clear.
A missing canonical tag does not, by itself, prove that a page cannot be indexed. A self-reference can make the intended address clearer, but adding one does not fix unrelated access or content problems. Start with the technical checks in the on-page SEO checklist before rewriting the article.
Multiple or conflicting declarations
Record every value and the component that generated it. Common suspects include a theme, an SEO plugin, a custom template and a response-header rule.
Choose the intended source of truth, correct the relevant configuration and confirm the public result contains one consistent preference. If two declarations point to different destinations, do not keep both and hope the engine chooses the one you meant.
A canonical target redirects, errors or excludes indexing
Follow the target all the way to its final response. If the preferred page has permanently moved, update the declaration to the intended final destination. For an error, staging page or unintended noindex, resolve the underlying route or indexing policy.
Do not remove a legitimate noindex from private or intentionally excluded content merely to satisfy a canonical check. The site's publishing and access goals still apply.
Different pages all declare the homepage
Inspect the template rule. A hard-coded site-root URL can be accidentally repeated across unrelated articles.
Correct the mapping so each distinct article identifies its appropriate preferred address. Then sample several routes, including an older post and a new one. Fixing only the page that triggered the warning may leave the shared defect in place.
IP canonicalization and hostname variants
IP canonicalization concerns a site being accessible through an IP-based address as well as its intended hostname. Hostname, HTTP/HTTPS and www/non-www variants can create similar URL-management questions.
Have the hosting administrator check routing, certificates and redirects for the intended deployment. Where alternate addresses should no longer serve independent copies, redirect to the intended hostname while preserving meaningful paths. Do not attempt to canonicalize your IP address by replacing public article links with a bare IP.
Google chose another canonical
Compare the content and signals before calling the selection wrong. Google may have recognized a genuine duplicate, or the site may be sending an unexpected preference.
Google's canonicalization troubleshooting guide directs attention to technical declarations, server configuration, localization and content differences. Use those as investigation categories, not as a claim that any one issue caused your result.
If the selected page fulfills the same task better, reassess your preferred version. If two pages are genuinely distinct, make the distinction clear through their substance and purpose. Changing only a title or adding repeated keywords is a weak response to a duplicate-content question.
Pagination, filters and hreflang need separate decisions
Do not canonicalize every paginated page to page one
The second page of a listing can contain items absent from the first. Google's pagination recommendations say to give pages in a sequence their own canonical URLs rather than using page one for all of them.
Inspect the actual items shown. A first-page alias such as ?page=1 may be equivalent to the unparameterized first page; ?page=2 usually represents another portion of the listing. Do not treat every parameter as a tracking duplicate.
Filters need the same content-level judgment. A filter that changes the available products can differ meaningfully from a parameter that only records a campaign. Decide the desired indexing and crawl behavior for the particular pattern instead of stripping every parameter automatically.
Canonical and hreflang describe different relationships
A canonical identifies the preferred representative of equivalent content. Hreflang connects alternate language or regional versions.
For distinct English and Spanish articles, a typical arrangement gives each language page its own canonical and lists the corresponding language alternatives. Google's localized-page guidance explains reciprocal annotations and fully qualified alternate URLs. Regional variants with essentially the same language content need additional care; do not assume every locale must be handled identically.
The language code en identifies English. A regional extension such as en-GB identifies an English variant intended for the United Kingdom. A region code on its own is not a language declaration.

An English page's example declarations could be:
<link rel="canonical" href="https://example.com/en/audit">
<link rel="alternate" hreflang="en"
href="https://example.com/en/audit">
<link rel="alternate" hreflang="es"
href="https://example.com/es/auditoria">On the corresponding Spanish page, the canonical would identify the Spanish address while the alternate set identifies both versions. Do not set every translation's canonical to the English URL simply because English is the default navigation language.
A worked canonical repair record
Suppose an illustrative site has an article at /guides/site-audit?utm_source=email. It displays the same content as /guides/site-audit, but a template accidentally declares /guides/keyword-planning.
The problem is the content mismatch, not the presence of the tracking parameter. The record should make that reasoning inspectable:
- Requested URL: the site-audit article with the email parameter.
- Observed declaration: the keyword-planning article.
- Expected destination: the equivalent clean site-audit article.
- Evidence: compare the actual primary content of both destinations and their responses.
- Proposed repair: correct the template's preferred-URL mapping for the affected route.
- Follow-up: inspect both the clean and parameter URLs, confirm the final destination and check controlled internal links.
- Search engine selection: not established by this example; record it separately from an available indexed report.
This is a hypothetical diagnosis, not a client result. It demonstrates how to explain why a repair is appropriate without claiming the tag caused a traffic change.
After a real repair, keep the observation date and implementation details. Bing's discussion of duplicate content and URL management also emphasizes clear preferred versions and consistent signals. Technical cleanup can improve clarity without guaranteeing indexing, rankings or AI citations.
Canonical URL FAQs
Is a self-referencing canonical required for every page?
It is useful for making the preferred address explicit on ordinary indexable pages. Its absence alone does not prove an indexing failure. Verify that any automatic or manual declaration points to the right content and does not conflict with other signals.
Can two different articles use the same canonical because they share keywords?
Shared keywords do not make the articles equivalent. Compare the reader task and main content. Use a consolidation plan only when the pages actually represent the same or very similar content; preserve distinct useful articles as distinct pages.
Does a canonical merge Google Analytics traffic?
Do not expect a canonical tag to move visitors or automatically merge analytics sessions and reports. Review the measurement platform's URL handling separately. Search engine selection and analytics configuration are different systems.
Can a canonical solve every “discovered but not indexed” issue?
No. Check access, response, indexing directives, content and the available report before diagnosing a canonical conflict. A clean declaration is one observation, not proof that a search engine must index the page. If Search Console shows that Google knows the URL and has yet to crawl it, use the Discovered – currently not indexed checklist to check current access and decide what to investigate.
How long does it take for a canonical correction to appear in reports?
There is no universal completion time. Compare the live implementation with the available indexed report and its timing. Monitor later observations without treating missing data, a live-test result or an unchanged report as evidence of a guaranteed outcome.



