
In e-commerce stores, ranking high in search results is crucial for driving traffic and sales. But what happens when Google sees multiple pages on your Magento 2 store with identical or very similar content? You risk facing duplicate content penalties, which can severely damage your search visibility. This is where understanding and implementing Magento 2 Canonical URLs becomes essential. This blog post will explain everything you need to know about canonical URLs, duplicate content, and how the S-Commerce Canonical URLs extension can help you solve these critical SEO issues.
We’ll cover:
- What duplicate content is and why it’s a problem for Magento 2 stores.
- What canonical URLs are and how they work.
- The benefits of using canonical URLs.
- A detailed look at the S-Commerce Magento 2 Canonical URLs extension.
- Step-by-step instructions on how to use the extension.
- Best practices for canonical URLs in Magento 2.
1. Understanding Duplicate Content in Magento 2
What is Duplicate Content?
Duplicate content refers to blocks of content that are identical or substantially similar across multiple web pages, either within the same website or across different websites. There are two main types:
- Exact Duplicates: Pages with completely identical content.
- Near Duplicates: Pages with mostly the same content, but perhaps with minor variations (e.g., different product colors or slightly different wording).
Why is Duplicate Content Bad for SEO?
Google wants to provide the best possible search results to its users. When it encounters multiple pages with the same content, it struggles to determine which page is the original or most relevant. This can lead to several problems:
- Crawling Inefficiency: Google wastes resources crawling duplicate pages.
- Ranking Dilution: Link equity and other ranking signals are split between duplicate pages, making it harder for any single page to rank well.
- Indexing Issues: Google may choose to index the wrong version of a page, or not index any version at all.
- Potential Penalties: In severe cases, Google may penalize your site for having excessive duplicate content.
Common Duplicate Content Issues in Magento 2:
Magento 2, while a powerful platform, can be prone to duplicate content issues due to its flexible configuration options. Here are some common culprits:
- Product Variations: Products available in different colors, sizes, or other attributes often share very similar descriptions and can have nearly identical URLs.
- Layered Navigation (Filters): Applying filters (e.g., price range, color) can create numerous URLs that display essentially the same product listings.
- Pagination: Category pages with multiple pages (e.g.,
?p=1
,?p=2
) can be considered duplicate content. - Session IDs in URLs: URLs containing session IDs create unique URLs for the same content each time a user visits.
- Print-Friendly Versions: Separate URLs for print-friendly versions of pages.
- WWW vs. Non-WWW and HTTP vs. HTTPS: Your site should redirect correctly to a single preferred version (e.g.,
https://www.yourstore.com
). - Trailing Slashes: URLs with and without trailing slashes (e.g.,
/category/
vs./category
) can be treated as duplicates. - Category Path in Product URLs: Magento allows you to include or exclude the category path in product URLs, potentially creating duplicate URLs for the same product.
2. What are Canonical URLs?
A canonical URL is the URL of the page that Google considers to be the “master” or preferred version among a set of duplicate or near-duplicate pages. It’s specified using the <link rel="canonical" href="...">
tag in the <head>
section of your HTML.
How Canonical URLs Work:
When search engines encounter the rel="canonical"
tag, they understand that the specified URL is the one you want them to index and prioritize in search results. This helps consolidate ranking signals (like links) to the canonical page, improving its chances of ranking well.
Example:
Let’s say you have two versions of a product page:
https://www.yourstore.com/red-widget
https://www.yourstore.com/widgets?color=red
You want the first URL to be the preferred version. You would add the following canonical tag to both pages:
<link rel="canonical" href="https://www.yourstore.com/red-widget" />
This code is telling search engines to treat the page with the URL “https://www.yourstore.com/red-widget” as the master or main page.
Benefits of Using Canonical URLs:
- Improved Search Engine Rankings: Consolidate ranking signals to the preferred page, boosting its visibility.
- Better Crawl Budget Management: Help search engines crawl your site more efficiently by focusing on the important pages.
- Prevent Duplicate Content Penalties: Avoid penalties associated with duplicate content issues.
- Control over URL Displayed in Search Results: Ensure the correct URL is shown to users in search results.
- Improved User Experience: Direct users to the most relevant and authoritative version of a page.
For more detailed information on canonical URLs, refer to Google’s official documentation: Consolidate duplicate URLs
3. Introducing the S-Commerce Magento 2 Canonical URLs Extension
Manually managing canonical tags for every page in a Magento 2 store can be a tedious and error-prone process. The S-Commerce Magento 2 Canonical URLs extension provides a powerful and automated solution to streamline this process.
Overview:
This extension simplifies the implementation of canonical URLs across your entire Magento 2 store, helping you eliminate duplicate content issues and improve your SEO. It offers a range of features to customize how canonical URLs are generated and managed.
Key Features:
- Granular Control Over Canonical Tags – Manage canonical tags separately for categories, products, CMS pages, and other site pages.
- Primary Category for Products – Set a primary category for each product to ensure the correct category path appears in canonical URLs.
- Custom Canonical URLs – Override default canonical URLs for individual products, CMS pages, and other site pages.
- Canonical Tag Management for Other Pages – Define custom canonical URLs for specific site pages using route names.
- Noindex, Nofollow Control – Add noindex, nofollow meta tags to specific pages to manage search engine indexing.
- Flexible Meta Robots Settings – Configure index, follow or noindex, nofollow directives for products, categories, and CMS pages.
- Automated Primary Category Assignment – Use a built-in command-line script to assign primary categories to products automatically.
4. How to Use the S-Commerce Canonical URLs Extension
Install the module using the user guide provided by us, then follow the steps below for setup:-
Configuration:
Accessing the Configuration:
- Go to Admin > Stores > Configuration > Scommerce Configuration > Canonical Tags.
- Enable: Select “Yes” to enable the module under general settings.
Category Canonical Tag:
- Category Canonical Enable: Set to “Yes” to enable canonical tags on category pages.
- Exclude Current Category in Admin: Set to “Yes” to prevent a category from being selected as its own canonical category (prevents loops).
- Append Text with Every Category URL Path: Set to “Yes” if you want to add text to overridden canonical URLs. This is useful for distinguishing between paginated/filtered pages when using custom canonicals.

Product Canonical Tag:
- Product Canonical Enable: Set to “Yes” to enable canonical tags on product pages.

CMS Canonical Tag:
- CMS Canonical Enable: Set to “Yes” to enable canonical tags on CMS pages.

Others Pages Canonical Tags
- Other Page Canonical Enabled: Set to “Yes” to enable the module.
- Custom Canonical Tag Links: Click on add and add the full route name of the page for eg:- when visiting the checkout page your URL will look something like http://demo2.scommerce-mage.co.uk/contact/. Here “contact” is your full route name. Lastly, enter the Canonical tag link that you want to send with the URL.

No Index, No Follow:
- No Index No Follow Enabled: Set to “Yes” to enable the
noindex, nofollow
feature. - Action names: Add action names (one per line) to apply
noindex, nofollow
to specific pages. - Route names: Add route names (one per line) to apply
noindex, nofollow
to groups of pages.

Product-Specific Settings:
- Go to Admin > Catalog > Products.
- Select the product you want to configure.
- Go to the “Search Engine Optimization” tab.
- Primary Category: Select the primary category for this product. This is crucial if the product belongs to multiple categories.
- Override Canonical URL: Enter a custom canonical URL here if you want to override the default behavior.
- Robot Settings: Choose the desired meta robots settings (e.g.,
index, follow
,noindex, nofollow
).

Category-Specific Settings:
- Go to Admin > Catalog > Categories.
- Select the category you want to configure.
- Go to the “Search Engine Optimization” tab.
- Canonical URL: Select the primary category to be included in the canonical URL tag (This seems redundant given the “Primary Category Settings” mentioned later, but it’s in the documentation).
- Override Canonical Tag: Enter a custom canonical URL here if needed.
- Robot Settings: Choose the desired meta robots settings.

CMS Page-Specific Settings:
- Go to Admin > Content > Pages.
- Choose the page you want to configure.
- Go to the “Search Engine Optimization” tab.
- Override Canonical URL: Enter a custom canonical URL here if needed.
- Robot Settings: Choose the desired meta robots settings.

Setting Primary Categories (Bulk):
- Category Priorities:
- Go to Admin > Catalog > Categories.
- Select a category.
- Scroll down to “Primary Category Settings.”
- Exclude From Primary Category: Check this to prevent the category from being automatically assigned as a primary category.
- Priority: Enter a priority number (0 being the highest). Higher priority categories will be chosen first.

Running the Script:
- Connect to your server via SSH.
- Navigate to your Magento root directory.
- Run the command:
php bin/magento scommerce:seo-base:set-primary-category
Testing:
After configuring the extension, it’s vital to verify that canonical URLs are being generated correctly. Here’s how:
- View Page Source:
- Go to a page on your website (e.g., a product page, category page).
- Right-click on the page and select “View Page Source” (or a similar option, depending on your browser).
- Look for the
<link rel="canonical" ...>
tag in the<head>
section of the HTML. - Verify that the
href
attribute contains the correct canonical URL you expect.
- Use Google Search Console:
- Go to Google Search Console (https://search.google.com/search-console/).
- Use the URL Inspection tool.
- Enter the URL of a page you want to check.
- Google Search Console will show you the canonical URL that Google has detected for that page. Make sure it matches what you expect.
- Use SEO Tools:
- Use 3rd party SEO tools such as Screaming Frog.
5. Best Practices for Canonical URLs in Magento 2
- Consistency: Be consistent with your canonical URL strategy across your entire site. Choose a method (e.g., shortest URL for products) and stick with it.
- Self-Referencing Canonical URLs: Every page should have a canonical URL, even if it’s the only version of the page. This is called a self-referencing canonical URL, and it’s a good practice to prevent unexpected issues.
- Avoid Canonicalizing to Irrelevant Pages: A canonical URL should only point to a page with identical or very similar content. Never point a canonical URL to a completely unrelated page.
- Use Absolute URLs: Always use absolute URLs (including the
https://
and your domain name) in the canonical tag, rather than relative URLs. This avoids any potential ambiguity. - Monitor Google Search Console: Regularly monitor Google Search Console for any canonical URL-related errors or warnings. This will help you identify and fix any problems quickly.
- One Canonical Tag Per Page: Ensure that each page has only one
<link rel="canonical" ...>
tag.
Conclusion: Simplify Magento 2 Canonical URLs with S-Commerce Extension
Canonical tags are a critical part of any Magento 2 store’s SEO strategy. They resolve duplicate content issues, consolidate ranking signals, and guide search engines to the most relevant pages. The S-Commerce Canonical URLs Extension makes this process easy with its flexible configuration options for products, categories, CMS pages, and more.
By following this guide, you can effectively implement canonical tags and improve your store’s SEO performance. Ready to take control of duplicate content? Download the S-Commerce Canonical URLs Extension today and supercharge your Magento 2 SEO!