• Complete Python Masterclass for Web Dev 🚀 🚀 🚀

Understanding Canonical URLs: The Definitive Guide

The link element rel=”canonical” â€“ often referred to as a canonical URL – is extremely important yet still frequently subject to common misconceptions and incorrectly used even by seasoned SEOs who’ve been in the industry for a while. 

So, without further ado – in this guide, let’s take a close look at what canonical URLs are, how to use them, when to use them & more…

In this guide, we’ll take a look at:

1 What Are Canonical URLs?

Canonical URLs

A canonical URL is a link element that can be used to indicate to search engines that specific URLs are all related to a master page.

In short, they help you specify which version of a URL you would like to appear in search results. This is useful because, in some cases, where you may have content that is accessible via multiple URLs or different websites entirely, you can use canonical URLs to avoid duplicated content from negatively affecting rankings.

Technically speaking, canonical URLs are simply HTML link tags that make use of the rel=canonical attribute. Simply put, here’s how canonical URLs work:

A canonical URL is set by placing what is referred to as a canonical tag onto pages. Canonical tags are just snippets of HTML code that define what the main/master page is for these potentially duplicated pages.

canonical tag itself is a snippet of HTML code that is used to define what the main versions of duplicated or similar pages are. In a whole range of scenarios (which we’ll cover in this guide), where you have content that is either the same or very similar available under different URLs, canonical tags should be used to specify which version is the main (or master version) and should, therefore, be indexed by search engines (such as Google)…

2 Why Canonical URLs Matter?

Now that you know what canonical tags & URLs are, let’s take a look at why they matter and you should start considering setting different canonical URLs for certain posts and pages on your websites.

Just as you’d expect, Google isn’t a fan of duplicate content mainly because it makes it more difficult for them to rank pages. In other words:

How should Google know which version of a page to index and subsequently rank as well as how to distribute “link equity”?

Too much duplicate content can also affect your “crawl budget.” That means Google may end up wasting time crawling multiple versions of the same page rather than other important content on your website.

IMPORTANT SIDENOTE

Canonical tags actually aren’t new. Although it is possible that some people haven’t come across this concept (until now!), canonical tags were actually introduced all the way back in 2009.

Too much duplicate, as well as too much low-quality content, evidently isn’t good for your website.

Why would you want Google to waste time crawling multiple versions of the same page instead of focusing on the important pages of your website?

If new pages tend to be crawled the same day they’re published, crawl budget is not something webmasters need to focus on. Likewise, if a site has fewer than a few thousand URLs, most of the time it will be crawled efficiently.

Google Webmaster Central Blog (source)

While Google says that this usually isn’t an issue, the use of canonical tags can remedy all of these potential issues because they not only allow you to indicate [to Google] which version of a page should be indexed but also where link equity (colloquially referred to as “link juice”) should be consolidated.

3 Setting Canonical URLs for WordPress Posts & Pages

The Rank Math SEO WordPress plugin makes it easy to change the canonical URL using the meta box (as pictured below).

By default, Rank Math makes use of the current post/page URL as the canonical URLs so you would only need to alter this setting if you wish to change it to something else.

Rank Math Canonical URL WordPress

This is also known as a self-referencing canonical, which we’ll cover later along with all the other scenarios in which canonicalization is beneficial.

4 Setting Canonical URLs Manually (Advanced)

If your website doesn’t currently take advantage of the WordPress content management system which currently powers over 40% of all websites on the internet, including sites like CNN, Bloomberg & more – here’s how you can manually set canonical URLs for pages on your website… 

So, as mentioned earlier – a canonical URL is simply set by using the HTML link attribute rel=”canonical”. Therefore, in order to set one on any page of a website, simply add the following code in the <head> </head> section of a webpage’s HTML source code:

<link rel="canonical" href="https://rankmath.com/about/">

And then, simply replace https://rankmath.com/about/ with the URL that you’d like to set as the canonical URL for the page that you’ve added the above code to. 

5 When Should You Use Canonical URLs?

5.1 301 Redirects vs Using rel=canonical

Not sure if it would make more sense to implement a redirect or make use of canonicalization? The easiest way to put it is: 

If it’s possible to use redirects to fix the problem, use a redirect. However, use canonical URLs if you still want both versions of the page to be accessible (just not in search results) and it simply wouldn’t be possible to use redirects to make that happen. In other words, if a webpage is identical or near-duplicate and serves no additional purpose in being accessible to the internet (i.e. users of your site or search engines), then simply redirect it to whichever you consider a priority. 

And when this isn’t possible because both pages still serve a valid & valuable purpose in being accessible, then use a canonical URL to specify which of the related pages you’d prefer search engines to consider as the original/master page. 

5.2 Do Pages Need a Self-Referencing Canonical URL?

In the image of the Rank Math SEO Meta Box that appeared earlier in this post, we didn’t link another page by inserting a URL but the canonical URL was set to to the current page itself.

It’s strongly recommended to have the rel=canonical link elements on all pages mainly because this has been adopted as a best practice ever since Google confirmed that this is the best way to deal with it.

The potential side-effect of not having self-referencing canonical URLs on pages that point to the plain version of the URL is running into duplicate content errors. That’s why adding a self-referencing canonical to URLs is good practice – and you’ll be pleased to hear that the Rank Math SEO plugin already does this so you don’t have to worry about it.

Most people assume that their website doesn’t have any duplicate content because they obviously haven’t published the same piece of content over and over on purpose. That being said, that isn’t necessarily true because search engines crawl individual URLs, not pages on your website.

Yes, this really means that they would see rankmath.com/blog/seo-audit and rankmath.com/blog/seo-audit?id=123 as unique pages despite being the same actual page with either very similar or exactly the same content.