How do I configure canonical URLs in Magento?

Configure Canonical URLs in Magento

Configuring canonical URLs in Magento helps prevent duplicate content issues by specifying the preferred version of a webpage. This can improve your SEO by consolidating page authority and directing search engines to the primary version of a page.

Steps to Configure Canonical URLs in Magento

Enabling Canonical URLs for Products and Categories

  1. Log in to the Magento Admin Panel:
    • Open your web browser and navigate to the URL of your Magento admin panel.
    • Enter your admin username and password, then click on "Sign in."
  2. Navigate to the SEO Settings:
    • In the left sidebar, go to Stores > Configuration.
    • In the Catalog section, click on Catalog.
  3. Enable Canonical URLs for Products:
    • Expand the Search Engine Optimization section.
    • Set Use Canonical Link Meta Tag For Products to "Yes".
  4. Enable Canonical URLs for Categories:
    • Set Use Canonical Link Meta Tag For Categories to "Yes".
  5. Save the Configuration:
    • Click Save Config to apply the changes.

Configuring Canonical URLs for Custom Pages

  1. Navigate to CMS Pages:
    • In the left sidebar, go to Content > Elements > Pages.
  2. Edit a CMS Page:
    • Find the page you want to add a canonical URL to and click on it to edit.
  3. Add Canonical URL in the Layout Update XML:
    • In the Design tab, find the Layout Update XML field.
    • Add the following XML code to specify the canonical URL:
      <reference name="head">
          <action method="addLinkRel">
              <rel>canonical</rel>
              <href>{{canonical_url}}</href>
          </action>
      </reference>
    • Replace {{canonical_url}} with the actual URL you want to set as canonical.
  4. Save the Page:
    • Click Save to apply the changes.

Using a Third-Party Extension for Advanced Canonical URL Management

For more advanced canonical URL management, you might consider using a third-party extension. Some popular options include:

  • SEO Suite Ultimate by Mageworx
  • Advanced SEO Suite by Mirasvit

Installing and Configuring a Third-Party Extension

  1. Choose an Extension:
    • Go to the Magento Marketplace and search for a canonical URL management extension.
    • Purchase and download the extension.
  2. Install the Extension:
    • In the Magento admin panel, go to System > Web Setup Wizard > Extension Manager.
    • Find the extension you purchased in the list and click Install.
    • Follow the on-screen instructions to complete