Magento 2 Canonical Urls for Category, Product, CMS, and Other pages

Installation and User Guide for Magento 2 Canonical URLs for Category, Product, CMS, and Other pages

Table of Contents

  1. Installation
    • Installation via app/code
    • Installation via Composer
  2. Configuration Settings for SEO Base
    • General Settings
  3. Configuration Settings for Canonical Tags
    • General Settings
    • Category Canonical Tag
    • Product Canonical Tag
    • CMS Canonical Tag
    • Others Pages Canonical Tags
    • No Index No Follow
    • Product set up for Canonical URL
    • Category set up for Canonical URL
    • CMS set up for Canonical URL
  4. Set Primary Categories
  5. Front-end Site View
    • Category Canonical Tag
    • Product Canonical Tag
    • CMS Canonical Tag

Installation

Installation via app/code: Upload the content of the module to your root folder. This will not overwrite the existing Magento folder or files, only the new contents will be added. After the successful upload of the package, run below commands on Magento 2 root directory. 

php bin/magento setup:upgrade 
php bin/magento setup:di:compile 
php bin/magento setup:static-content:deploy

Installation via Composer: Please follow the guide provided in the below link to complete the installation via composer.

https://docs.scommerce-mage.com/magento-2-extensions/installation-via-composer/installation-via-composer

Configuration Settings for SEO Base

Go to Admin> Stores> Configuration> Scommerce Configuration> SEOBase

General Settings

image.png

Configuration Settings for Canonical Tags

Go to Admin > Stores > Configuration >Scommerce Configuration > Canonical Tags

General Settings

image (1).png

Category Canonical Tag

image (2).png

Product Canonical Tag

image (3).png

CMS Canonical Tag

image (4).png

Others Pages Canonical Tags

image (5).png

No Index No Follow

image (6).png

Product set up for Canonical URL

Go to Admin > Catalog > Products > Select Product (for which you want to set Canonical URL) > Search Engine Optimization Tab

image (7).png

Category set up for Canonical URL

Go to Admin > Catalog> Category > select category (for which you want to set canonical URL) > Search Engine Optimization Tab

image (8).png

CMS set up for Canonical URL

Go to Admin > Content > Pages > Choose page (for which you want to set canonical URL) > Search Engine Optimization Tab

image (9).png

Set Primary Categories

You can use a script provided with the extension to automatically add primary categories for products. Admin can exclude certain categories from primary category and also prioritise one category over the other to be picked as the primary category.

Go to Admin>Catalog>Categories select a category then scroll down to find the option "Primary Category Settings". Here click on "Exclude From Primary Category" to exclude this category from primary category or enter the priority 0 being the highes. The highest priority category will be picked first for the primary category.

image (10).png

To automatically assingn primary category for all products run the command given below by going into the root directory of your store. 

scommerce:seo-base:set-primary-category

N.B - If you are using older version then run the script provided in the extension folder at the path Data/SetPrimaryCategoryM2.php from ssh

Front-end Site View

image.jpg

image (1).jpg

image (11).png

image (2).jpg

If you have a question related to this extension please check out our FAQ section first. If you can't find the answer you are looking for then please contact support@scommerce-mage.com.


Revision #5
Created 1 May 2025 12:50:41 by scommerce
Updated 24 October 2025 09:32:21 by scommerce