en
English Español Deutsch Français Italiano Português (Brasil) Русский 中文 日本語
Go to Blog
James Brockbank

Canonical URLs: A Beginner's Guide to Canonical Tags [2020]

98
Wow-Score
The Wow-Score shows how engaging a blog post is. It is calculated based on the correlation between users’ active reading time, their scrolling speed and the article’s length.
This post is in English
James Brockbank
This post is in English
Guide to Canonical Tags and URLS

Understanding how to properly use canonicalization and set canonical URLs is essential knowledge for any SEO, and incorrect implementation of these can cause widespread issues that negatively impact your site's performance.

Canonical tags were first introduced in 2009 to help webmasters overcome duplicate or vastly-similar content that is accessible on multiple URLs.

But to use canonical tags properly, you need to understand what they are, how they work, and how to implement them. 

Canonical Tag Guide

Here are the main points we will cover in this guide:

What Are Canonical Tags & Canonical URLs?

Often referred to as rel="canonical," canonical tags are a way of telling the search engines that a specified URL is the master copy of a page. 

They allow you to specify the canonical URL for a page.

But wait, what is the difference between canonical tags and canonical URLs? And are there other ways to specify these?

Canonical Tags

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

<link rel="canonical" href="https://www.website.com/page/" />

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. 

Canonical URLs

So then, what is a canonical URL? This is the URL that is chosen as the 'master' URL for a set of duplicate pages. 

In Google's own words:

A canonical URL is the URL of the page that Google thinks is most representative from a set of duplicate pages on your site.

— Google Search Console Help

You can indicate your preferred canonical URL. However, Google may choose a different page than you do for various reasons.

That said, in most instances, when set correctly, it will be your specified URL that is chosen as the canonical.

Put simply, canonical URLs dictate which page will usually (except in the case where a duplicate is explicitly better suited for a user, let's say a mobile-specific version) be shown in the search results. 

The canonical URL of a page can be on a different domain.

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 canonicals:

  • By setting a rel=canonical HTTP header response.
  • In your sitemap (however, while all pages listed in a sitemap are suggested as canonicals; Google will decide which pages (if any) pages are duplicates).
  • By using 301 redirects.

That said, while these are all ways that are recommended by Google, they are not all suitable to use in every situation, as we will explore below, and each has its own recommended reasons for use. 

Just so that you are aware, setting canonical URLs isn't a requirement, and in instances that you do not specify one, Google will use other signals to identify the page that they think is the best version.

However, it is recommended that you use cannibalization effectively, to ensure that you are able to control how your site appears on the search engines and to prevent issues that arise as a result of duplicate content.

Check Your Website's Health

With the SEMrush Site Audit Tool

Please specify a valid domain, e.g., www.example.com

Reasons Why Duplicate Content Exists

Before we look at the reasons why you should use canonical URLs and how to specify these across the most popular CMS', you need to understand why duplicate content exists in the first place. No one sets out to create duplicate content within a site. 

Usually, this happens when content management systems create multiple URLs when you launch a page, when you have different versions of your site that are indexable, have an alternate version for different device types, or use dynamic URLs. 

Take a look at the following URLs and assume that, to a user, they all display exactly the same content:

  1. https://www.website.com/category/product-a/
  2. https://www.website.com/product-a/
  3. https://website.com/product-a/
  4. http://www.website.com/product-a/
  5. http://website.com/product-a/
  6. https://m.website.com/product-a/
  7. https://www.website.com/product-a
  8. https://www.website.com/product-A/

To a search engine, this isn't one page of content, it is eight duplicate pages:

  • URLs #1 and #2 come about as a result of the CMS saving product URLs both with and without the category name.
  • URL #3, #4 and #5 are a result of the site being accessible both on HTTP and HTTPS versions, as well as www and non-www versions. 
  • URL #6 is the mobile-friendly version that sits on a subdomain.
  • URL #7 is the non-trailing slash version of URL #2. 
  • URL #8 uses a capital 'A' in place of a lowercase used elsewhere across the site. 

You might also find duplicate content exists across URLs such as:

  • https://www.website.com/
  • https://www.website.com/index.php 

Now see how it's easy for duplicate content to happen?

In fact, many sites have these issues without you even realizing it, but canonical URLs help search engines to identify different variations of a page as a single URL. 

Why You Should Use Canonical URLs for SEO

Canonical URLs exist to help you deal with duplicate content issues that could affect the performance of your site. 

But, more specifically, there is a number of reasons why you should be using canonical URLs as just one technical SEO focus area:

Specify the URL that Should Be Shown in Search Results

When you set a canonical URL, you are giving an indication as to which version of a page should be displayed on the SERPs.

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

  • https://www.domain.com/page-1/
  • https://www.domain.com/index.php?id=2

Most likely, the first one.

Use canonicals to specify the URL that you want the search engines to rank.

Consolidate Link Signals Across Duplicate or Near-Identical Pages

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

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

This, in itself, can help your site to rank given that 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 SERPs and to ensure that the original piece of content is the one that ranks, you can use canonical URLs to consolidate ranking signals.

Prevent Googlebot Crawling Duplicate Pages

Especially so if you are working with a large website with lots of pages, you can use canonical URLs to ensure that Googlebot spends time crawling your new pages rather than duplicated versions of the same one across mobile and desktop versions, as an example.

That said, crawl budgets aren't an issue for most sites unless you've got hundreds of thousands, or more, pages. 

How to Correctly Implement the rel=canonical Tag

By far, the most common way to specify canonical URLs is by using the rel="canonical" tag in your page's header.

Adding tags and HTML code might sound daunting if you re not a developer, but the majority of CMS platforms allow you to specify canonicals out-of-the-box.

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">
<rel>canonical</rel>
<href>https://www.website.com/page-a/</href>
</action>
</reference>

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: Amasty.com

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 http://www.website.com/category/product.html.

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

Setting canonical URLs on WordPress couldn't be easier. However, how to implement these depends on which WordPress SEO plugin you are using. 

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}"/>

Setting a Canonical URL on Shopify

Out of the box, a number of SEO issues exist with Shopify stores that make it essential to understand cannibalization — with a key problem being that the platform will allow a single product page to exist on multiple URLs.

Take a look at Shopify's guidance, and you will see that, when developing a Shopify theme, you can use the {{ canonical_url }} object to output the canonical URL of the current page. 

But let's make it clear, you can't specify custom canonical URLs in the same way as you can on Magento, WordPress, or Wix.

The problem is that, by default, Shopify creates product URLs that update dynamically so that they contain the collection that they originate from.

You could find a single product on the following URLs:

  • https://www.website.com/products/product-a
  • https://www.website.com/featured-collection/products/product-a
  • https://www.website.com/sales-collection/products/product-a

These all return the same product page, just on different URLs, and while Shopify's canonical tags do properly resolve to the correct canonical URL, you will also find internal links pointing to the duplicate versions, adding to the confusion.

You can clean this is by taking the steps outline in this great guide from Path Interactive.

Head into your theme's liquid files and look for the following code that will most commonly be in the collection-template.liquid file:

{{ product.url | within: collection }}

Go ahead and edit this to:

{{ product.url }}

You should now find that your both your canonical tags and internal links are correct. 

How to Correctly Implement a rel="canonical" HTTP Header

An alternative to using canonical tags is to implement a rel="canonical" HTTP header.

This is the implementation approach that you need to take to specify a canonical URL for PDFs or other non-HTML documents.

You need to be able to access your site's .htaccess file to implement this and can specify a canonical URL using the following code:

<Files "file-to-canonicalize.pdf">
Header add Link "< http://www.website.com/canonical-page/>; rel=\"canonical\""
</Files>

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, this is typically the best way to resolve duplicate content issues across:

  • HTTP and HTTPS
  • Non-WWW and WWW
  • Trailing-Slash and Non-Trailing Slash URLs

On a single page basis, there needs to be more careful consideration and usually canonical tags are your best solution unless you can confidently delete and redirect a page. 

Canonical URLs in Sitemaps

To put it simply, 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. It is an easy mistake to make to reference the wrong protocol so be sure to check for this happening to be able to catch it before it becomes an issue.

Specify Either Trailing Slash or Non-Trailing Slash URLs

Pay attention to whether your site uses trailing slashes or not at the end of URLs and be sure to reference your canonical URL correctly in this way. 

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 be using:

<link rel="canonical" href="https://www.website.com/page-a/" />

And not:

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

Use Self-Referencing Canonical URLs If Not Canonicalizing to a Different URL

While it is not a requirement, you should always be sure to implement self-referencing canonical URLs when a page is not canonicalizing to another URL.

This is where a page's canonical tag references itself.

Common Mistakes to Avoid when Implementing Canonical Tags

It is not uncommon to inadvertently make mistakes when implementing canonical tags and here are some of the more common ones that are seen.

Canonicalizing to a 301 Redirect

Be careful not to canonicalize to a URL that is then redirected, rather you should set the canonical URL to be the redirect target.

Canonicalizing to an Incorrect Domain Protocol

If your site sits on HTTPS, be careful not to set your canonical URLs with HTTP by accident.

Canonicalizing to Irrelevant Content

You shouldn't be canonicalizing your URLs to content that isn't either a duplicate or that is near-identical.

We occasionally see that SEOs try to pass link signals via canonical tags from unrelated content to try and increase the rank — this isn't the way canonicalization should be used and should be avoided at all costs. 

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 all will be ignored. 

Be careful to avoid accidentally including two canonical tags within your page's <head>, as this can sometimes happen when trying to override defaults in some CMSs.

Confusing Pagination & Canonicalization

There is no denying that pagination can, if implemented incorrectly, cause duplicate content. But canonicalizing all of the URLs in a series back to the first page isn't always the best solution.

Rather, you should canonicalize these to a 'view all' page.

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.

No Redirect or Canonical to HTTPS Homepage from HTTP Version

If your site can be accessed on both HTTPS and HTTP versions, you will experience duplicate content issues and this will be flagged in the Site Audit.

You can fix this by 301 redirecting one version to the correct version or add a canonical tag that references the HTTPS version on the HTTP pages.

Pages with a Broken Canonical Link

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

Seeing this error could mean that your canonical links 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. 

Canonicalization is one of the most important concepts for you to understand as an SEO, and using it incorrectly can have a negative impact upon your site's performance.

That said, once you understand how it works and what it does, alongside how to find and fix issues, you will be in a great position to ensure that you are able to use it effectively and rid your site from duplicate content. 

Google's Canonicalization SEO Mythbusting

James Brockbank
Legend

Getting here is not easy at all!

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.
Send feedback
Your feedback must contain at least 3 words (10 characters).

We will only use this email to respond to you on your feedback. Privacy Policy

Thank you for your feedback!