Add Custom Canonical Tags for Magento 2 Pages

When you add canonical tags in Magento 2 you ensure that the right version of the pages is indexed and ranked in search results. However, sometimes the canonicals you enable don't fit your SEO strategy. So you might want to change them. 

Unfortunately, you can't set custom canonical tags in Magento by default. Not unless you use the Magento 2 SEO Extension. So, today you'll learn how you can easily change or set custom canonical tags for your store pages. 

Use case

When we go to the Men > Tops category ( and filter products by category Jackets we get the following URL — The canonical for this page is still So we'll change that.

canonical tags in magento 2

To add custom canonical tags in Magento: 

1. Navigate to Marketing > SEO by Magefan > SEO Rules and press on the Add New SEO Rule button. 

2. Enable the rule, and set a Name and Priority for it.

3. Choose a Specific Page as a Page Type and set the Custom URL of that page.

custom canonical tag magento

Note: you can skip the meta tags, H1 and meta robots fields if you only want to set custom canonical tags.

4. Specify the Canonical URL for a specific page. 

custom canonical url magento

Once you Save the rule, a custom canonical tag is applied to a specified page. 

custom magento 2 canonical tags

In our case the URL is changed to the Men > Tops > Jackets category ( that was used in the filters. 

The best part is you can choose literally any page to add custom canonical tags to. Products or categories work too. 

However, custom canonical tags are still a small part of the SEO rules features. You can also configure metadata for multiple pages in bulk with meta tags templates to automate your store SEO.