In this guide
- What Is a Canonical Tag in Magento 2?
- Does Magento 2 Add Canonical Tags Automatically?
- How to Set Canonical URL in Magento 2 (Built-In Settings)
- Magento 2 Canonical Tags: Product, Category and CMS Page Examples
- Magento 2 Set Canonical URL for a Custom Page
- Magento 2 Custom Canonical Tag: Important Implementation Rules
- Magento 2 Add Canonical to CMS Page
- Magento Layered Navigation SEO and Filtered URLs
- Magento Product Page Duplicate URLs and Product Variants
- Canonical Link vs Redirect vs Noindex in Magento 2
- Magento 2 Sitemap.xml and Internal Linking Must Match Canonicals
- How to Check Magento 2 Canonical URLs in Google Search Console
- Common Magento 2 Canonical Problems and Fixes
- Magento 2 Canonical URL Best Practices Checklist
- Frequently Asked Questions About Magento 2 Canonical URLs
- Final Thoughts: Canonical Tags Should Support Your Magento SEO Strategy
A Magento 2 canonical URL tells search engines which version of a page should be treated as the preferred URL when multiple addresses display identical or similar content. Configuring canonical tags correctly helps consolidate ranking signals, manage duplicate product and category URLs, and improve how search engines understand your Magento store.
Magento 2 includes built-in canonical tag settings for product and category pages, but CMS pages, layered navigation, filtered URLs and certain product variations may require additional configuration.
In this guide, you'll learn how to set canonical URLs in Magento 2, add custom canonical tags, troubleshoot common SEO issues and verify your implementation using Google Search Console.
What Is a Canonical Tag in Magento 2?
A canonical tag is an HTML link element placed in the page’s <head>. Its rel="canonical" attribute points to the preferred URL for a duplicate or near-duplicate page. It is a signal rather than a directive: Google may still select a different canonical if the pages and other signals do not support your preference.
<link rel="canonical" href="https://www.example.com/blue-shirt.html" />For example, one shirt might be accessible through /blue-shirt.html and /mens/shirts/blue-shirt.html. Both pages could point to /blue-shirt.html if they show the same product. The chosen product URL should normally have a self-referencing canonical too.
The SEO benefit is more reliable URL consolidation and less unnecessary crawling of duplicate pages. Duplicate content does not automatically cause a Google penalty, so the priority is controlling indexation and avoiding split signals, rather than trying to “avoid a duplicate content penalty”.
Canonical duplication is not the same as keyword cannibalisation. If two distinct pages target the same search intent, first check whether they should serve different audiences or be consolidated. See our Keyword Cannibalization guide for the broader content-targeting issue.
Does Magento 2 Add Canonical Tags Automatically?
Magento 2 and Adobe Commerce provide native settings to generate canonical link elements for product and category pages. However, these settings are not a complete canonicalisation strategy. They must be enabled for the appropriate store view, and they do not automatically resolve every CMS page, filtered URL, product variant or third-party extension scenario.
You should review generated HTML rather than assume the Magento 2 SEO settings are active. A theme, extension, custom controller or cache issue can change the final canonical link element. For stores with complex templates or multiple extensions, a specialist SEO audit service can help identify conflicts before changing global settings.
How to Set Canonical URL in Magento 2 (Built-In Settings)
- Sign in to the Magento Admin panel.
- Go to Stores › Settings › Configuration.
- Open Catalog › Catalog and expand Search Engine Optimization.
- Select the correct website/store view scope, if relevant, and clear Use system value to edit a setting.
- Set Use Canonical Link Meta Tag for Categories to Yes and Use Canonical Link Meta Tag for Products to Yes if both page types should output the standard self-referencing canonical. Review your URL architecture before choosing store-wide behaviour.
- Click Save Config. Clear relevant caches using your normal deployment process.
- Open a product and a category page, view the rendered source and confirm each outputs exactly one appropriate canonical link.
These labels are documented by Adobe, but the final choice depends on your catalogue architecture. For products reachable through multiple category paths, a clean product URL without the category path is often the easiest canonical target.
Do not change production settings without sampling existing URLs and redirects.
Magento 2 Canonical Tags: Product, Category and CMS Page Examples
| Page type | Example preferred canonical | What to check |
|---|---|---|
| Product | https://www.example.com/blue-shirt.html | All duplicate product paths point to the same live product |
| Category | https://www.example.com/mens/shirts.html | Category canonical is not a filter URL by mistake |
| CMS page | https://www.example.com/delivery | CMS page has one self-referencing canonical where appropriate |
| Tracking parameter | https://www.example.com/blue-shirt.html | UTM URL does not become the canonical |
Magento 2 Set Canonical URL for a Custom Page
For a custom canonical tag, first confirm that a native feature or extension is not already outputting one. Adding a second canonical link can create conflicting signals. Any override must replace the existing output cleanly and respect store-view URLs, HTTPS and current URL rewrites.
For a developer-managed custom page, Magento’s page configuration head API can be used to add a canonical link. The following PHP fragment is an illustrative implementation inside a custom controller or view model integration, not a standalone drop-in file:
$page = $this->resultPageFactory->create();
$page->getConfig()->addRemotePageAsset(
'https://www.example.com/preferred-page',
'canonical',
['attributes' => ['rel' => 'canonical']]
);
return $page;Your developer should generate the canonical URL using the correct store context rather than hardcoding a production domain, and confirm the method is supported by the Magento version in use. Check that the resulting page has one canonical element and no contradictory canonical generated elsewhere.
Magento 2 Custom Canonical Tag: Important Implementation Rules
- Choose an absolute HTTPS URL that returns 200 OK, is indexable and serves equivalent primary content.
- Keep product, category and custom-page canonical logic consistent across all relevant store views.
- Avoid pointing every paginated, filtered or product-variant URL at a parent page without considering whether its content deserves its own index entry.
- Do not canonicalise a page to a redirect, broken page, unrelated product or blocked target.
- Where the duplicate URL is genuinely obsolete, a permanent redirect is usually more appropriate.
Magento 2 Add Canonical to CMS Page
Magento’s native product and category toggles do not provide a universal per-CMS-page canonical field. For pages such as About Us, Delivery or a campaign landing page, your options depend on the installed modules and theme: a reputable SEO extension with per-page canonical fields, or a developer-controlled layout/custom module implementation.
A developer can implement a CMS-page-specific head update using Magento layout configuration and a custom module. The exact layout handle, XML and URL generation depend on the version, theme and CMS page identifier. Validate the output on the intended CMS page only, so a shared layout update does not accidentally apply one canonical URL to every CMS page.
If the CMS page is unique and indexable, use a self-referencing canonical. If it reproduces an established permanent page, canonicalise to that page only when the main content is materially equivalent. A 301 redirect may be better if the duplicate page no longer needs to be accessible.
Magento Layered Navigation SEO and Filtered URLs
Layered navigation is a common source of duplicate content in Magento. Size, colour, brand, price and sorting parameters can generate many category URL combinations. Some filtered pages are valuable landing pages; others simply rearrange or narrow the same listings.
For non-strategic filter combinations with substantially overlapping content, a canonical to the main category may be appropriate. For a filter page with genuine search demand, a stable URL, unique merchandising and useful copy, consider making it an independently indexable landing page with its own canonical. Canonical tags alone do not prevent search engines from crawling a large parameter space.
For stores with extensive filters, combine canonical planning with crawlable navigation rules, sensible parameter handling and an indexation policy. These decisions should also align with your category-page targeting. Our Category Page SEO guide explains why valuable category URLs need distinct search intent and content, while our Magento SEO service page covers layered-navigation issues across larger catalogues.
Magento Product Page Duplicate URLs and Product Variants
Duplicate product URLs often appear when a product is accessible through multiple category routes or URL rewrites. Ensure the canonical points to the chosen product URL and that internal links favour that same address.
Variants need a different decision. If size or colour variants have practically identical page content, consolidating them to a parent product may make sense. If variants have distinct search demand, useful differentiating content and their own dedicated landing pages, automatically canonicalising all of them to one parent could remove valuable pages from search results. Apply the policy based on the actual product experience, not a blanket rule.
Canonical Link vs Redirect vs Noindex in Magento 2
| Method | When to use it | Main consideration |
|---|---|---|
| rel=canonical | Duplicate or near-duplicate URLs should remain accessible | Google treats it as a signal, not an order |
| 301 redirect | An old or duplicate URL should no longer be accessible separately | Visitors and crawlers are sent to the preferred URL |
| noindex | A page should not appear in search at all | Do not use as a substitute for canonicalisation |
| robots.txt disallow | Prevent crawling of chosen URL patterns when appropriate | Blocked pages may be unable to pass a visible HTML canonical signal |
An SEO policy should distinguish index vs noindex Magento decisions from canonicalisation decisions. Do not use noindex simply to force Google to pick another canonical. Likewise, avoid blocking a duplicate URL in robots.txt if Google needs to crawl the page to discover its canonical annotation.
Magento 2 Sitemap.xml and Internal Linking Must Match Canonicals
Keep the Magento 2 sitemap.xml focused on preferred, indexable URLs. If your sitemap lists one URL but its canonical points elsewhere, you give conflicting signals. The same principle applies to breadcrumbs, category links, product recommendations and other internal links: wherever practical, link directly to the chosen canonical URLs.
A broader technical review should also check metadata, URL rewrites and architecture. Strong canonical signals work best alongside sound on-page optimisation, clear category targeting and useful content. This is especially important in an Ecommerce SEO service, where indexable product and category URLs should support buying-intent searches. A focused SEO content strategy can then build relevance around the pages you actually want indexed.
How to Check Magento 2 Canonical URLs in Google Search Console
- Inspect the preferred product, category or CMS URL using Google Search Console URL Inspection.
- Compare User-declared canonical and Google-selected canonical, where available.
- Inspect representative duplicates, including category-path products, query-parameter URLs and filtered pages.
- Check whether the canonical target returns 200, is indexable, appears in the intended sitemap and has consistent internal links.
- Use a crawler to find missing, duplicate, non-self-referencing or conflicting canonicals across templates.
- After fixing the problem, request re-indexing for priority URLs if appropriate and monitor results. Google may take time to reassess canonical clusters.
A different Google-selected canonical does not always mean there is an error. Assess whether the selected URL is genuinely a better representative of the duplicate set before changing site configuration.
Common Magento 2 Canonical Problems and Fixes
| Problem | Likely cause | Recommended action |
|---|---|---|
| Canonical tag is missing | Native toggle off, unsupported template or custom override | Check store scope and generated head output |
| Two canonical tags | Theme or extension adds another tag | Remove duplicate output at its source |
| Canonical points to old URL | Stale rewrite, cache or version-specific bug | Check rewrites, cache, patches and update behaviour |
| Every filter points to category | Overly broad navigation rule | Separate indexable landing pages from duplicate filters |
| Google selects a different URL | Signals conflict or pages differ substantially | Align internal links, sitemaps, redirects and page content |
| CMS page has no canonical | No native per-page implementation | Add a controlled CMS-specific solution |
Adobe has documented a quality patch for a category canonical that failed to update following a URL-key change in affected versions. Before customising core behaviour, check whether your Magento build is affected and whether a supported patch is available. Issues that persist across templates often call for a wider magento technical seo review of generated URLs, routing and extensions.
Magento 2 Canonical URL Best Practices Checklist
- Enable product and category canonical settings where appropriate and verify final rendered output.
- Use one valid absolute canonical URL per HTML page and consider self-referencing canonicals.
- Make canonical targets indexable, accessible and content-equivalent.
- Give high-value filter pages and product variants their own indexation strategy.
- Keep XML sitemaps, internal links and canonical targets aligned.
- Use permanent redirects for obsolete URLs rather than relying on canonical tags alone.
- Review canonicals after migrations, URL-key changes, theme releases and extension updates.
- When migrating from Magento 1 or rebuilding an Adobe Commerce store, update canonical targets alongside redirects and sitemaps. Use our Magento migration SEO guide as a broader launch checklist so the new URLs send consistent signals from day one.
- Audit Google-selected canonicals periodically, especially for revenue-driving product and category pages.
Frequently Asked Questions About Magento 2 Canonical URLs
The rel=canonical tag identifies the preferred URL among pages with the same or very similar main content. Magento can generate these tags on products and categories when the relevant settings are enabled; Google still makes the final canonical selection.
Go to Stores > Settings > Configuration > Catalog > Catalog > Search Engine Optimization and enable the appropriate product or category canonical options. Use a page-specific customisation or compatible extension for cases the native settings do not cover.
They help clarify the preferred product or category URL where multiple routes show equivalent content, making indexation signals more consistent. They are especially useful for category paths, URL parameters and duplicate product routes.
Start by identifying duplicated URLs and deciding which ones should remain indexable. Use canonicals for near-duplicates that must remain accessible, redirects for obsolete URLs, and distinct content for important standalone pages. Then align sitemaps and internal links.
Magento 2 has built-in product and category canonical settings, but their output depends on configuration. CMS pages, filters and custom implementations may need separate rules or development.
Developers can add a canonical page asset through Magento’s page configuration APIs in a custom module or controller. The implementation must use the correct store URL and avoid outputting a second, conflicting tag.
There is no universal best extension. Look for compatibility with your Magento version, per-page CMS controls, configurable filtered URL rules, multi-store support, safe canonical overrides and reliable maintenance. Test it on staging and confirm it produces one canonical tag per page.
Self-referencing canonicals are generally useful on indexable, canonical HTML pages, but not every URL should be indexed. Duplicates may point elsewhere, while intentionally non-indexable pages require a separate strategy.
Final Thoughts: Canonical Tags Should Support Your Magento SEO Strategy
Magento 2 canonical URLs are a small piece of code with a major role in managing large ecommerce catalogues. Start with the native settings, audit real product and category URL patterns, and apply custom rules only where your architecture needs them. The goal is a clear set of indexable pages, not the indiscriminate consolidation of every URL.
If product variants, layered navigation or custom modules have created conflicting signals, a technical audit can show which pages are worth indexing and which should consolidate. Smarketa’s Magento SEO team can help prioritise the fixes that matter to organic product and category visibility.
Related Services & Articles

Full Technical SEO Checklist (From Start to Finish)
The crawling, indexing and site health checks we run before any content or optimisation work begins.
Read Article
The Rise of Category Page SEO: Why It's the New Ecommerce Priority
Why category pages have become the authority hubs of ecommerce SEO, and how to optimise them for high-intent searches.
Read Article
SEO Mistakes Killing Ecommerce Revenue
The technical and content issues, from duplicate product descriptions to slow pages, that quietly cost online stores sales.
Read Article
