Canonical URLs: A Beginner’s Guide to Canonical Tags

Rachel Handley

Jun 13, 202311 min read
Guide to Canonical Tags and URLS
Share

TABLE OF CONTENTS

Understanding canonical URLs is essential in SEO. 

Learn how you can use canonical tags (and other canonicalization methods) to influence canonical URLs. And improve your site’s performance on Google.

Let’s dive in.

What Is a Canonical URL?

A canonical URL is the version of a webpage chosen by search engines like Google as the main version when there are duplicates. This selected URL is prioritized to avoid showing repetitive content that does not provide unique value in search results.

Consider these two URLs:

  • Canonical URL: https://example.com/blog/
  • Alternate URL: https://example.com/blog/?page=1

In this example, Google will likely choose the canonical URL for indexing and ranking. The canonical page is also called the “principal,” “primary,” or “representative” version.

Note: Google doesn’t always make the decision you want. However, you can influence canonicalization by using canonical tags. And a few other methods.

What Is a Canonical Tag?

A canonical tag, also known as rel="canonical" tag, is a snippet of HTML code that allows you to define the “primary” version in a set of duplicate or near-duplicate pages on your site.

In SEO, canonical tags suggest to Google which version of the page it should index, consolidate link equity (ranking strength) to, and show in search results.

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

<link rel="canonical" href="https://example.com/preferred-url-here/" />
an image highlighting "alternate URL" and "Canonical Tag"

Typically, canonical tags point from an alternate page to the preferred page.

an illustration of canonical tag pointing from an alternate page to a preferred one

But it’s also a good idea to use self-referencing canonicals

In other words, each canonical page should have a canonical tag that points to its own URL.

Like this:

an image highlighting "self-referencing canonical"

Google’s John Mueller confirmed the importance of self-referencing canonicals.

“It’s not critical to have a self-referencing canonical tag on a page, but it does make it easier for us to pick exactly the URL that you want to have chosen as canonical,” he said in a Google Webmaster Central office-hours hangout.

Why Use Canonical Tags?

Canonical tags are a valuable deduplication tool. They can resolve issues with duplicate content (or near-identical pages) you need to keep.

For example: 

  • American English and British English versions of the same page
  • Parameterized URLs (e.g., listings pages with filters or sorting options applied)

Why avoid duplicate content?

Because it can cause keyword cannibalization. This occurs when multiple pages on a site compete for the same rankings. And harm each other’s rankings in the process. 

By using canonical tags correctly, you help Google understand your site’s structure. And identify the best version of a duplicated page.

This helps ensure that the version you want is the one shown in search results (and the one searchers access). This can lead to higher click-through, engagement, and conversion rates.

Plus, Google consolidates the “ranking power” of alternate pages on canonical URLs.

Let’s say you have backlinks (links from external domains) pointing to various duplicate pages. 

If these pages canonicalize, Google will treat them all as links to the canonical URL. Together, they have a positive impact on rankings.

an illustration of backlinks, alternate URLs and canonical URLs connection

Note: Google no longer recommends using canonical tags for syndicated content. Instead, syndication partners are advised to block indexing with the proper meta tags.

How to Implement Canonical Tags

To implement canonical tags in your HTML, you can add the rel="canonical" tag to the <head> section of the page. 

As a reminder, that looks something like this:

<link rel="canonical" href="https://example.com/preferred-url-here/" />

But your content management system (CMS) or a CMS plugin may allow you to specify canonicals without going into the HTML. 

Keep reading for instructions on Magento 1, Magento 2, WordPress, and Wix.

Or jump ahead to learn about other canonicalization methods.

Magento 1

If you’re running a Magento 1 store, follow these steps to specify canonical URLs for product and category pages.

Product Page Canonicals

Log into your admin panel, then head to “System” > “Configuration.” 

Click “Catalog” and open the “Search Engine Optimizations” section.

where to specify canonical URLs for product and category pages in Magento 1

If it isn’t already, set the “Use Canonical Link Meta Tag For Products” field to “Yes.”

set the “Use Canonical Link Meta Tag For Products” field to “Yes”

Category Canonicals

Head back to the “Search Engine Optimizations” section on the “Catalog” page.

Find the “Use Canonical Link Meta Tag For Categories” option and make sure it’s set to “No.”

set the “Use Canonical Link Meta Tag For Categories” option to "No"

Now, you can manually specify the canonical URL for categories.

Head to the edit page of any category that you want to canonicalize and find the “Custom Design” tab.

In the “Custom Layout Update” box, add the following code. Making sure to swap in your canonical URL.

<reference name="head">
<action method="addLinkRel">
<rel>canonical</rel>
<href>https://example.com/preferred-url-here/</href>
</action>
</reference>
“Custom Layout Update” box in Magento 1

Magento 2

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

Log into your admin panel, then go to “Stores” > “Settings” > “Configuration.”

Next, open “Catalog” > “Catalog” and go to the “Search Engine Optimization” section.

“Search Engine Optimization” section in Magento 2
Image Credit: Amasty.com

Set “Use Canonical Meta Tags For Categories” to “Yes” so Magento will automatically add canonical tags to alternate category pages.

The default config path is “catalog/seo/category_canonical_tag.”

Also set “Use Canonical Meta Tags For Products” to “Yes” so Magento will automatically add canonical tags to alternate product pages.

The default config path is “catalog/seo/product_canonical_tag.”

WordPress

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

We’ll look at how to do this with two of the most popular plugins: Yoast SEO and Rank Math SEO.

Yoast SEO Plugin

If you’re using the Yoast SEO plugin, head to the Yoast SEO options on any page or post. 

Then, expand the “Advanced” tab. 

You’ll find a “Canonical URL” field where you can specify the page’s canonical URL.

“Advanced” tab in Yoast SEO options

Rank Math SEO Plugin

If you’re using the Rank Math SEO plugin, head to the “Rank Math SEO” box on any page or post. And open the “Advanced” tab.

The “Canonical URL” field allows you to specify the canonical URL for the page.

“Advanced” tab in “Rank Math SEO” box

Wix

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

You can change the structure of your canonical tags by going into your SEO settings.

First, head to “Marketing & SEO” > “SEO” > “SEO Settings.” And then choose the type of page that you want to edit.

For this workflow, we selected “Main Pages.” 

"Edit by page type" section in Wix “SEO Settings”

After selecting the type of page, click on the “Edit” button within the “Additional meta tags” section.

“Edit” button within the “Additional meta tags” section highlighted

Finally, add variables to the field under “canonical” by clicking on “+ Add Variable.” And selecting relevant items from the list that appears.

adding variables section with a drop-down menu

You can also edit the canonical tags of individual pages. Just click on the “Edit by Page” tab and select the page with the canonical tag that you want to edit.

Then, click on the “Advanced” tab in the sidebar that appears. And go to “Additional tags.”

image guiding readers how to edit the canonical tags of individual pages

Finally, edit the link that appears in the “canonical” field.

“canonical” field highlighted

Other Ways to Specify Canonical URLs

Typically, you specify canonical URL preferences using canonical tags. But there are other methods you can try:

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

Let’s look at these deduplication methods in more detail.

Use rel=“canonical” in HTTP Headers

A rel=“canonical” HTTP header allows you to specify a canonical URL for non-HTML documents.

For example, if you have a .docx and .pdf version of the same document online, you can use this method to indicate your preferred version.

However, you need to be able to change your server’s configuration.

In the .htaccess file, specify a canonical URL by adding code that looks like this:

Link: <https://www.example.com/downloads/filename.pdf>; rel="canonical"

Redirect Duplicate Pages to Canonical Pages

URL redirects send Google (and users) from one page to another. 

Redirecting is the best deduplication method if you don’t need to keep the alternate versions of the page. But you don’t want to delete the URLs altogether.

For example, when you have HTTP and HTTPS versions of the same page. Google prefers HTTPS versions. So, it’s good for your SEO to redirect the HTTP version to the HTTPS one.

Google recommends using 3xx redirects (server-side redirects) for the quickest results. 

This includes the 301 redirect, which you can learn more about in our 301 redirect guide.

List Canonical URLs Only in Your Sitemap

“All pages listed in a sitemap are suggested as canonicals,” according to Google.

This means it’s a good idea to submit canonical URLs (and non-duplicated pages) only in your sitemap. And leave alternate URLs out. 

It’s not a huge issue if you leave duplicate pages in your sitemap. Google will decide which version is canonical. 

But it could be a problem if you leave preferred URLs out. So, keep your sitemap updated.

Canonical Tags: SEO Best Practices

If you don’t implement canonicals correctly, Google might ignore them. And that can harm your SEO performance.

Follow these canonical tag best practices for the best results:

Only Specify One Canonical URL Per Page

Only specify one canonical URL per page. Otherwise, you’ll confuse Google.

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.

And if you add rel="canonical" to the HTML, don’t also add it to the HTTP header.

Specify the Correct Domain Protocol

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

Check out our guide to learn more about redirecting from HTTP to HTTPS.

Specify Trailing Slash or Non-Trailing Slash URLs

Pay attention to whether your pages use trailing slashes (i.e., “/” symbols at the end of URLs). 

For example: 

  • Trailing slash: https://example.com/
  • Non-trailing slash: https://example.com

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.

And try to be consistent across your site.

Specify Non-WWW or WWW URLs

Non-WWW and WWW versions of a URL are seen as duplicate pages by search engines. 

For example: 

  • Non-WWW: https://example.com/
  • WWW: https://www.example.com/

It’s best to choose one version and stick with it across your entire site.

Use Absolute URLs

Canonical tags should be referenced using absolute URLs rather than relative URLs.

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

<link rel="canonical" href="https://example.com/blog/" />

And not a relative URL. Like this:

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

Common Mistakes to Avoid When Implementing Canonical Tags

It’s easy to make mistakes when implementing canonical tags. 

Here are two of the more common canonical tag errors:

Pointing Canonical Tags to Redirected Pages

Be careful not to specify a canonical URL that redirects. This will only confuse Google.

For example, let’s say Page A redirects to Page B.

You should not have any canonicals that point to Page A. They should point directly to Page B instead.

Using Canonical Tags for Non-Duplicate Content

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

Some SEOs try to use canonical tags to consolidate the ranking power of dissimilar pages. 

For example, to direct authority from out-of-stock product pages to category pages.

However, Google advises against this practice. And is highly likely to ignore these canonicals.

How to Audit Canonical Tags on Your Site

Find out what Google considers to be the canonical URL for any page on your website with Google Search Console.

After logging in, search for a URL at the top.

search for a URL in Google Search Console

When the “URL Inspection” report is ready, open the “Page indexing” section.

Scroll down to see the “Google-selected canonical.”

“Page indexing” section in Google Search Console

If this isn’t your preferred URL, you may need to review the deduplication strategy on your page. 

To start, make sure that the “User-declared canonical” is present and correct.

“User-declared canonical” section highlighted in Google Search Console

To audit your site’s canonical tags at scale, use Semrush’s Site Audit tool.

Once setup is complete, go to the “Issues” tab.

Then search “canonical.”

search "canonical" in “Issues” tab in Site Audit

Check for the following errors:

Site Audit results showing the list of different issues and errors

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

# Pages Have Duplicate Content Issues

This error shows how many pages on your site could be considered duplicates. Because they feature content that’s at least 85% identical to content on another page.

Click the link to see affected URLs.

"17,764 pages have duplicate content issues" page

You can then decide how to resolve the issue. See our duplicate content guide for advice.

# Pages Have Multiple Canonical URLs

This error shows how many pages on your site specify more than one canonical URL.

Click the link to view a detailed breakdown.

"3 pages have multiple canonical URLs" page

To fix this issue, you need to remove the extra canonical tag(s) and leave just one in place. 

This issue shows which pages on your site have broken canonical links—i.e., specify a canonical URL that doesn’t work.

(Perhaps because it contains a typo. Or the page has been deleted.)

Click the link to see affected pages and the canonical URLs they point to.

"120 pages with a broken canonical link" page

Canonical tags that point to non-existent webpages complicate Google’s ability to crawl and index your content properly. That could harm your rankings.

Make sure to update these to the correct canonical URLs.

# AMP Pages Have No Canonical Tag

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

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

Like this:

how to fix when an AMP page doesn’t have canonical tag

Tip: You can use the check boxes and “Send to…” button at any stage to create tasks in the Semrush CRM, Trello, or Zapier. 

“Send to…” button in Site Audit with drop-down menu options: "CRM", "Trello" and "Zapier"

When you’ve fixed these issues, rerun the Site Audit using the gear icon in the upper-right. 

gear icon in the upper-right highlighted

Then, check that the canonical errors have disappeared. 

"Errors" section in Site Audit showing "0 errors"

Ready to start addressing canonical issues? Get started with Site Audit.


This post was updated in 2023. Excerpts from the original article by James Brockbank may remain.

Share
Author Photo
Rachel has been a digital marketer for over 11 years. Having worked both in-house and agency-side, she has a wide range of experiences to draw on in her writing. She specializes in creating beginner-friendly articles on topics including keyword research, on-page SEO, and content creation.
More on this