Canonical URLs: A Beginner’s Guide to Canonical Tags

James Brockbank

Nov 04, 202210 min read
Guide to Canonical Tags and URLS

A canonical URL is the URL of the principal version of a page when you have duplicate versions of that page on your website.

You set the canonical URL using a canonical tag in your HTML. Then, when Google crawls the page, it can distinguish this page from the duplicate pages.

Understanding canonical URLs is essential knowledge for SEO. Implementing canonical URLs correctly can help your site’s performance on Google and other search engines.

Read on to learn what canonical URLs are, how they work, and how to implement them. 

What Are Canonical Tags?

Canonical tags are bits of HTML that tell Google and other search engines which page is the canonical version.

Found in the <head></head> section of a web page’s HTML source code, a canonical tag looks like this:

<link rel="canonical" href="" />

The canonical tag says that the page it’s on isn’t the canonical URL. The canonical URL is the one it’s pointing to after “href.”

These can either be self-referencing (where a canonical tag point to a page’s own URL) or can reference another page’s URL to consolidate signals.

Often, we see the terminology of canonical tags and URLs used interchangeably, whereas this shouldn’t be the case. 

This is for the simple reason that using the rel="canonical" tag is the most commonly used method to set canonical URLs—however, it is by no means the only one. 

What Are Canonical URLs?

The canonical URL is the URL for the master copy of a page when you have duplicate versions of that page.

Since the duplicate pages are on different URLs, you can set a canonical URL so Google knows that that page is the original. Or the most representative.

The canonical version of the page is the most representative version of the page when you have duplicate versions of it on other URLs on your site.

How Else Can Canonical URLs Be Specified?

Canonical tags aren’t the only way that you can specify a canonical URL, despite being the most likely that you will use. 

You can also set canonical URLs:

  • In your HTTP header. Add the “rel=canonical” HTTP header response.
  • In your sitemap. The sitemap suggests to Google that all listed pages are canonical, but Google will understand which ones are duplicates.
  • By using 301 redirects. Google understands the redirected page as a canonical.

Knowing which type of canonicalization to use can ensure that you are able to control how your site appears on Google. And it can prevent issues that arise as a result of duplicate content.

To learn which pages are duplicates and need a canonical tag, run a site audit with Semrush:

Why You Should Use Canonical URLs for SEO

Canonical URLs help Google better understand your site. And that could help your site rank higher in search results.

That’s because they let search engines and users know which page the duplicate pages derive from. So it’s easier for Google to crawl your site and index it correctly.

Here’s how to use canonical tags to optimize your site for SEO:

Specify the Canonical URL that Should Be Shown in Search Results

Use canonical tags to specify the URL that you want the search engines to rank. That way, Google displays the original page instead of one of the derivative pages.

And the canonical URL might be more enticing for users to click on.

Think about it this way, which would you be more likely to click?


Most likely, the first one.

When you have duplicate or near-identical pages on your site, there is a chance that the individual URLs could earn backlinks from external sources. 

Use canonical URLs to consolidate the backlinks from multiple pages into a single URL that you specify.

This, in itself, can help your site to rank given that these link signals otherwise distributed across multiple URLs are consolidated into one stronger page.

Managing Syndicated Content

It is not uncommon for content to be syndicated across different websites to place it in front of new audiences. 

To prevent duplicate pages from ranking on the search engine results pages (SERPs) and to ensure that the original piece of content is the one that ranks, you can use canonical URLs to consolidate ranking signals.

How to Implement the Canonical Tag

You can specify canonical URLs in your HTML code. You need to use the rel="canonical" tag in your page’s header.

Your CMS may also allow you to specify canonicals without going into the HTML.

Setting a Canonical URL on Magento and Magento 2

If you are running a Magento 1 store, follow these steps to specify canonical URLs for products and categories.

Magento 1 Product Page Canonicals

When logged into your admin panel, head to System>Configuration and choose the Catalog tab and open out the Search Engine Optimizations section:

How to set canonicals urls in Magento

The ‘Use Canonical Link Meta Tag For Products’ should be set to yes.

Magento Canonical Link Meta Tag for products option

In many cases, you will find that this is already set to yes, which means you don’t need to do anything else on this.

Magento 1 Category Canonicals

Head back to the Search Engine Optimizations section on the Catalog page and find the ‘Use Canonical Link Meta Tag For Categories’ option.

How to Set Magento Category Canonicals

Make sure that this is set to no so you will be able to manually specify the canonical URL for categories.

Magento Custom Design Canonicals option

Head to the edit page of any category that you want to canonicalize and find the Custom Design tab and in the Custom Layout Update box and add the following code, being sure to switch in your own canonical URL.

<reference name="head">
<action method="addLinkRel">

Magento 2 Canonicals

If you are running a Magento 2 store, follow these steps to specify canonical URLs across your site.

When logged into your admin panel, head to Stores>Settings>Configuration, open out the Catalog drop-down, select Catalog and open the Search Engine Optimization tab.

How to specify canonical URLs in Magento 2

Image Credit:

If you set ‘Use Canonical Meta Tags For Categories’ to Yes, your store’s category pages will be set to specify a canonical URL to the full category URL, such as

If you set ‘Use Canonical Meta Tags For Products’ to Yes, your store’s product pages will be set to specify a canonical URL to the domain-name/product-url-key.

Even if you include the category path in the URL for products, this will still canonicalize to domain-name/product-url-key.

It is recommended that you choose Yes to add canonicals for both products and categories.

Setting a Canonical URL on WordPress

You can set canonical URLs on your WordPress site by using a WordPress SEO plugin. 

We will look at how to do this with two of the most popular plugins—Yoast and RankMath.

Canonical Tags with Yoast

If you are using Yoast, simply head to the Yoast SEO options on any page or post and expand the ‘advanced’ tab. 

Here you will find a field where you can specify the page’s canonical URL.

How to set Canonical Tags with Yoast

Canonical Tags with RankMath

If you are using RankMath, it is a similar way of implementation as above.

On any page or post, head to the ‘advanced’ tab of the RankMath meta box and you will see an option to specify a canonical URL for the page.

how to set canonicals on RankMath

Setting a Canonical URL on Wix

By default, Wix pages use a default self-referencing canonical tag.

If you need to change this, you can do so by heading to Menus & Pages, hovering over the relevant page and clicking the show more icon, then heading to SEO options > Advanced SEO and ‘Add New Tag’ under the Custom Meta Tags heading. 

how to set canonicals on Wix

Image Credit: Wix

Be sure to enter the full canonical tag, not just a URL.

You can change out your canonical URL in this code:

<link rel="canonical" href="{your-page-url}"/>

How to Set Canonicals in the HTTP Header

An alternative to using canonical tags is to implement a rel="canonical" HTTP header. This type of implementation is to specify a canonical URL for PDFs or other non-HTML documents.

You need to be able to access your site's .htaccess file. In the .htaccess file, specify a canonical URL by adding code that looks like this:

Link: <>; rel="canonical"

Using 301 Redirects to Specify Canonical URLs

Google states that you can use 301 redirects to specify canonical URLs. 

Let’s be clear, however, that if you use 301 redirects, only the canonical URL will actually exist. The other duplicate versions will redirect to this.

That said, 301 redirects are typically the best way to resolve duplicate content issues for some specific issues.

Like these:

  • When you have both HTTP and HTTPS versions of the page. Google prefers HTTPS versions, so it’s good for your SEO to redirect the HTTP version to the HTTPS one.
  • When you have both non-WWW and WWW versions of your site. This helps Google understand your site better.
  • When you have both trailing-slash and non-trailing slash URLs. When a URL ends in a trailing slash and you have an identical URL that doesn’t, Google may consider them two different pages.

Canonical URLs in Sitemaps

Google considers all URLs in a sitemap to be potentially canonical. If it finds duplicate content on the pages in the sitemap, Google will decide which version of the duplicate content is canonical.

If possible, be careful not to include non-canonical URLs in sitemaps as Google assumes that URLs specified in a sitemap to be canonical versions. 

This is not guaranteed to specify canonical URLs, but a best-practice to consider when structuring sitemaps. 

Canonical Tag Best Practices

Implementing canonical tags doesn’t need to be difficult, and once you understand a few simple best-practices, you will find that spotting and cleaning up duplicate content issues becomes a whole load easier.

When implementing canonical URLs, always be sure to:

Only Specify One Canonical URL Per Page

You should only ever specify one canonical URL per page, otherwise, you will likely find that all are ignored.

Specify the Correct Domain Protocol

If your site sits on the HTTPS protocol, be sure to reference this properly as your canonical URL. 

Specify Either Trailing Slash or Non-Trailing Slash URLs

Pay attention to whether your pages use trailing slashes or not at the end of URLs. If the same URL exists with both the trailing slash and without, Google may see them as two separate URLs. Be sure to reference your canonical URL correctly by including the trailing slash if needed.

Specify Either Non-WWW or WWW URLs

Non-WWW and WWW versions of a URL are seen as duplicate pages by search engines; so make sure to specify the correct one. 

Use Absolute URLs

Canonical tags should be referenced using absolute URLs, rather than relative, to ensure that they are properly interpreted.

That means you should include the full URL, including your domain. Like this:

<link rel="canonical" href="" />

And not this:

<link rel="canonical" href="/page-a/" />

Common Mistakes to Avoid when Implementing Canonical Tags

It is not uncommon to inadvertently make mistakes when implementing canonical tag. Here are some of the more common errors:

Don’t Set a Canonical Tag to A Redirected Page

Be careful not to create a canonical URL that is then redirected. Instead, set the canonical URL to be the redirect target.

Don’t Set a Canonical Tag to Irrelevant Content

Only set canonical URLs for duplicate or near-identical content. 

If you try to set a canonical tag to an irrelevant page, this will only confuse Google. And that could impact your ranking in the search results.

Setting Multiple Canonical URLs

You should only use a single canonical tag, or specify a single canonical URL, for each page. Otherwise, it is likely that some or all of the canonical tags will be ignored. 

Be careful to avoid accidentally including two canonical tags within your page’s HTML code. If you set the canonical tag using a setting in your CMS, don’t add additional canonical tags into your HTML manually.

How to Audit Canonical Tags on Your Site (and Fix Issues)

To be able to find any issues that exist with canonicalization, you will need to audit your site’s canonical tags.

You can do this with the Semrush Site Audit tool. When you run the site audit report for your website, you will find a number of checks that are related to canonical tags. 

Let’s look at what these are and how to fix the issues.

AMP Pages Have No Canonical Tag

When your AMP pages don’t have canonical tags, the Site Audit tool will flag this as an issue. It is important that canonicalization should be in place between AMP and non-AMP versions of your page.

You can fix this by adding a rel="canonical" tag in the <head> section of each AMP page that points back to the non-AMP page.

No Canonical Tags for Duplicate Content

Site Audit will flag when you have duplicate content and recommend adding a canonical tag or redirecting the page.

Duplicate content is considered to be content that is at least 85% similar to other content you have.

Pages with a Broken Canonical Tag

If your pages have broken canonical links, these won’t be understood as the canonical URLs. 

Seeing this error could mean that your canonical tags point to non-existent webpages and, as a result, complicate the process of crawling and indexing your content.

If you find pages with broken canonical links, be sure to update these to the correct canonical URLs.

Pages Have Multiple Canonical URLs

You will see this error when there is more than one canonical URL on a page. To fix this, you need to remove the duplicated tags and leave just one in place. 

To fix canonical tag errors and many other issues, get started with the Semrush Site Audit tool.

Author Photo
James is Managing Director of award-winning digital PR and SEO agency, Digitaloft, and has been involved in search marketing since the mid-2000s. He‘s a regular writer on topics including link building, content marketing and ecommerce, having previously contributed to the likes of Search Engine Journal.