The Ultimate Guide to Canonical URLs

Last Updated on March 7, 2023 by 3 Comments

Editorial Note: We may earn a commission when you visit links on our website.
The Ultimate Guide to Canonical URLs
Blog / WordPress / The Ultimate Guide to Canonical URLs

When content that’s exactly the same or almost exactly the same appears on two or more pages, that’s called duplicate content. The biggest problem with duplicate content is that search engines don’t know which version of the content to index or show in search results. It’s also difficult to figure out where to direct link metrics, like authority and trust. And when other sites need to choose between duplicate content versions to link back to, any of the many links may be chosen, which dilutes link equity. This is where canonical URLs come in. They’re used to clear up issues presented by duplicate content, which can improve your search engine ranking.

What Are Canonical URLs?

A canonical URL, referred to because of the HTML tag rel=”canonical”, is what search engines use to find the master version of content when there are multiple versions of a page either on the same website or on different websites.

For example, let’s say you publish a blog post on your own website. Then, you want to also publish that blog post on your LinkedIn and Medium accounts. With a canonical tag, you can let search engines know that even though the same blog post is on multiple websites, the one on your website is the master version, the one that should show up in search results.

And keep in mind that technically, a canonical URL isn’t really a URL — it’s more of a tag that’s attached to a URL to communicate its meaning to search engines. If an actual URL looks like http://example.com/blogpost, the canonical version would look like this:

Canonical URLs

You can’t go to that canonical URL like you can the main URL. Instead, the canonicalized version is placed in the HTML code of a page (or designated for the page via a plugin).

Why You Should Use Canonical URLs

The canonicalization of a URL tells the search engine which is the master version of a page, and that’s the page that should appear in search results, not the other duplicates of the page. When people are looking for content to link back to, the canonicalized page will show up, and they’ll choose that one, which builds link equity. Moreover, the metrics for a piece of content get consolidated for one page, which makes your metrics reports more reliable.

How to Use Canonical Tags Properly

Let’s say there’s duplicate content on your website (or on two different websites), but the main version you want to point search engines to is http://example.com/blogpost.

The canonical tag that you add to the blog post’s source code (the head section of the page’s HTML) will look like this:

Canonical URLs

If you’re using WordPress, you don’t have to fiddle with the HTML code like some other CMS platforms. Instead, you can use a plugin and set the canonical URL for each page. We’ll get more into that in a bit.

Canonical URLs and Copied Content

Copied content can be a problem. Canonical URLs let anyone who is going to copy the content know which tag to use in the header of their page. The copier, however, has a responsibility to tell search engines that they copied the content by putting the rel=”canonical” in the header of their site and pointing back to your content.

Other times, you may want to be the copier. This is common with press releases, for example. You can publish the press release on your company site first but attribute the original source of content to a syndication network. That would make you a syndicator, not the original publisher — at least according to search engines.

However, we should note that including the canonical URL in copied content ins’t always necessary. Or sometimes it’s ignored. Search engines do a great job of finding the true original source of the content. So, if you’re going to use a canonical URL to point to a non-original, like in the press release example above, just know that the search engine may ignore it. Use that tactic at your own discretion. It’s in a kind of icky grey area for SEO, if not a full-on black hat tactic.

Choosing a URL Structure

Even if you don’t think you have duplicate content anywhere online, the structure of your URLs could be accidentally creating duplicate content. For example, even if the following URLs display the same content, and you consider them the same page, search engines view them as separate:

  • http://www.examplesite.com – this has “www” included
  • http://examplesite.com – this has no “www” included
  • https://examplesite.com – this has “https” instead of “http”
  • http://www.examplesite.com/ – this has a slash at the end

There are also variations within HTTPS and trailing slashes and www, too. They’re all seen as separate pages according to search engines.

This means that you need to make a final decision about the structure of your URLs. Then, use that structure everywhere — on your site and wherever you refer back to your site. If you have to update your URLs, go with the structure you use most often to make this process less tedious. However, if you take sensitive information through your website, like credit card info, you’ll want to use HTTPS.

Duplicate content can also accidentally be created by your WordPress categories and tags. For example, these two URLs may lead to the same page, but a search engine will see them as two separate pages with duplicate content:

  • http://examplesite.com/store/candy/chocolate-truffles
  • http://examplesite.com/store/foods/chocolate-truffles

You may want users to find chocolate truffles whether they’re looking in the “Candy” or “Foods” category on your website. But search engines still need to know which one to rank in search results. This is why most of the top WordPress SEO plugins like Yoast and Rank Math offer an option to de-index your archives pages. That way, these duplicates won’t show up for Googlebot and its peers.

When Not to Use Canonical URLs

When it comes to 301 redirects, you may not want to use a canonical tag. Think of the difference this way: A redirect means there is only one place where the content appears, and you’re forcing all visitors to go to that one page. On the other hand, with a canonical URL, multiple pages containing the same content can exist and be viewed, with one original source designated for search engines.

Also, the rel=”canonical” URL element is not the solution for all duplicate content issues. SEO is a complex topic, and sometimes the more appropriate solution is to use a robots file to no-index a page instead. It’s recommended that you no-index pages that are not desirable entry points into your site, as well as pages that aren’t very useful to most visitors. For example, do you really need your Terms and Conditions page to appear in search results? Probably not. But your blog posts, product descriptions and sales pages? Definitely.

It’s also a good idea to check out Google’s article with five common mistakes when using the canonical tag. You can’t get much better than what Google says directly.

How Do Canonical URLs Affect SEO?

Now, while we definitely advise that you clear up duplicate content issues using canonical URLs, it’s important to note that Google doesn’t technically penalize sites for publishing duplicate content. However, it can hurt your search engine ranking — which is sort of like being penalized anyway. When search engines have a hard time figuring out which is the master version of a piece of content, no version gets ranked highly.

It’s also possible that the search engine will choose the wrong version and link to an untrustworthy site, which means that it may not get clicked and read at all if users don’t like how the URL looks. Furthermore, when there’s duplicate content on your website, your crawl budget gets eaten up. Search engines crawl and re-crawl websites to find new content, and if there’s duplicate content on your site, it takes longer to crawl it all. That means that the search engine will take longer to index those new pages and rank them in search results.

You can dive into this topic more by reading our Ultimate Guide to Duplicate Content and SEO. Google also has a helpful page about consolidating duplicate URLs.

How to Set a Canonical URL

In this section, we’ll walk you through how to set a canonical URL on WordPress and on a non-WordPress website.

Set a Canonical URL Using WordPress

While you can set canonical URLs without a WordPress plugin, we think the best, most foolproof, and flexible option is to use a plugin. For this walkthrough, we’re using Yoast SEO.

After installing and activating Yoast SEO, open up a WordPress page or post. Scroll down to the bottom of the post until you get to the Yoast SEO box. With the SEO tab selected (it will be by default), scroll down to the bottom, then click Advanced. At the bottom of the menu that appears, you’ll see a slot labeled Canonical URL.

Canonical URLs

Enter the full URL into this box, then save the changes to the post or page.

All in One SEO and Rank Math SEO are two other plugins you may want to consider.

Set a Canonical URL Outside of WordPress

If you’re not using WordPress, you can still set canonical URLs. First, you’ll need to access the webpage HTML. Each web builder will have its own process, but it should be fairly easy to find. For example, here’s how to add code to a Wix site. The process is similar for most non-WP builders and CMS platforms; you just have to find where they let you edit the page/post HTML.

You’ll then add the URL with the rel=“canonical” tag included to the head section. Using the example below, replace http://example.com/blogpost with your URL:

Canonical URLs

The HTML head section is the first part of the code. It opens withand closes with. Here’s an example:

canonical url example in html

To add code to the head section, you have to place it somewhere between the open and close tags. It’s best to add a link above the closing tag to keep it all organized.

How to Find a Canonical URL

If you want to see if a webpage has a designated canonical URL, it’s super easy. Open the page, then right-click, which will bring up a menu. Choose Show Page Source (or whatever option is close to that, like View Page Source). That will open a source page with HTML code. At the top, you should see the head section. Check in that section for the rel=“canonical” tag.

Canonical URLs

How to Remove a Canonical URL

Removing a canonical URL is pretty easy, too. You just take the same steps you took to add the URL, but delete it this time. If you used a plugin like Yoast, you can go into the page and delete the canonical URL from the associated field. If you added it directly to the HTML of a page, you can simply delete it and then update the page. That’s also why it’s a good idea to always add your canonical URLs in the same spot, like directly above the closing head tag.

Final Thoughts About Canonical URLs

The more pages you have on your website, the more labor-intensive it’ll be to get your canonical URL strategy in place. That’s why it’s best to handle this as early on as possible and to keep an eye on where your content is being republished online. Thanks to useful WordPress plugins like Yoast SEO, setting canonical URLs is easier than having to access each page’s HTML and editing the code manually.

What are some of your best practices for using canonical URLs? Let us know in the comments!

Article featured image by Thepanyo / shutterstock.com

Divi

Want To Build Better WordPress Websites? Start Here! 👇

Take the first step towards a better website.

Get Started
Divi
Premade Layouts

Check Out These Related Posts

WordPress Twenty Twenty-Five Review: 6.7 Features Worth It?

WordPress Twenty Twenty-Five Review: 6.7 Features Worth It?

Updated on December 9, 2024 in WordPress

WordPress recently launched its new default theme, Twenty Twenty-Five, along with WordPress 6.7. With new features and customization options, it offers more flexibility than the Twenty Twenty-Four WordPress theme. But is it worth making the switch? We put the new theme to the test and compiled this...

View Full Post
WordPress Security Guide for Busy Freelancers (2024)

WordPress Security Guide for Busy Freelancers (2024)

Posted on November 22, 2024 in WordPress

Though WordPress is built to be secure, it’s not entirely safe. It requires regular maintenance, and your responsibility increases even more when you manage your clients’ WordPress. This WordPress security guide lists effective set-it-and-forget-it ways for freelancers and agencies to...

View Full Post

3 Comments

  1. I was searching for home page canonical tag change in wordpress, but this is for post, this post doesn’t help me at all, pls improve knowledge and then post.

  2. I agree with Greg: a very well-written, interesting, and totally informative piece. Cheers!

  3. Thank you so much for this post. I have spent years not really understanding what canonical URLs are. I almost can’t believe that it is as simple and comprehensible as this article makes it.

    Big Thanks

Leave A Reply

Comments are reviewed and must adhere to our comments policy.

Get Started With Divi