Canonical URL

Joshua Hardwick
Head of Content @ Ahrefs (or, in plain English, I'm the guy responsible for ensuring that every blog post we publish is EPIC).

    What is a canonical URL?

    A canonical URL is a URL that Google sees as the “master” version of a set of duplicate or near-duplicate pages. Think of it as the difference between an original piece of art and its copies or prints. This canonical URL is what Google will index and potentially return to users in Google search.

    Why are canonical URLs important?

    Canonical URLs are important because Google will only index canonical URLs. This means that if you have duplicate content on your website, i.e., pages that are near or exact duplicates of each other, then Google is only going to index one of them (the canonical).

    If you set your canonical URLs properly, Google is likely to respect your decision and view that page as canonical. However, in the absence of a specified canonical for exact or near-duplicate pages, Google is going to use its best judgment to choose a canonical for you.

    The problem is, this may not be the URL you want Google to choose as the canonical one. So if you want to stand the best chance of it being the right one, you should manually set a canonical URL.

    How do you set a canonical URL?

    Google looks at several signals to determine the canonical URL for a set of duplicate or near-duplicate pages, one of which is the canonical tag. The canonical tag is a piece of HTML code that you add to the <head>

    section of a page to specify the canonical version of that page. It looks like this:

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

    For example, suppose you own an ecommerce store where visitors can filter products by parameters like style, size, and color. In that case, this typically results in parameterized URLs with virtually identical content to your “master page”:

    •  (“master” page listing all T-shirts)
    •  (identical to the “master” page but filtered for small T-shirts only)
    • (identical to the “master” page but filtered for red T-shirts only)

    Without proper canonicalization, you may end up in a situation where Google chooses to index the “wrong” version of the page or all of them.

    Both of these outcomes are often problematic for SEO.

    To ensure Google has everything it needs to index your page, you can set the canonical version of these URLs by using a canonical tag on the master page, pointing to the “master” version without the URL parameters.

    This helps Google to understand which version of the page it should index.

    Learn more: Canonical Tags: A Simple Guide for Beginners

    Best practices for canonical URLs

    Canonicalization is a complex and technical topic, but most website owners need only know a handful of best practices. So to keep things simple, we’ll cover just a few of them here.

    1. Use self-referencing canonical tags

    Self-referencing canonical tags are canonical tags on a page that points to itself. 

    For example, this page has a self-referencing canonical tag that looks like this:

    <link rel=“canonical” href=“” />

    Although using self-referential canonical tags isn’t mandatory and may also seem like a strange thing to do, Google’s John Mueller actually recommends their use:

    I recommend [using a] self-referential canonical because it really makes it clear to us which page you want to have indexed, or what the URL should be when it is indexed.

    John Mueller
    John Mueller, Search Advocate Google

    A self-referential canonical tag tells Google that you consider the URL to be canonical and that you’d like Google to index the page. Of course, indexing isn’t guaranteed, but the canonical tag, self-referential or otherwise, is one of the strongest signals Google uses to understand what is and isn’t canonical on your website.

    2. Exclude non-canonical URLs from your sitemap

    Google says you shouldn’t list non-canonical URLs in your sitemap because it sees these URLs as suggested canonicals.

    As with canonical tags, this doesn’t necessarily mean that Google will always treat a URL in your sitemap as canonical—but it’s yet another signal to help Google better understand how you view your site’s content.

    One quick way to check whether you have non-canonical URLs in your sitemap is to crawl your website for free using Site Audit in Ahrefs Webmaster Tools (AWT).

    Here’s how to do it in five simple steps:

    1. Create a free AWT account
    2. Add and verify ownership of your website
    3. Crawl your website with Site Audit
    4. Click “All issues” on the left menu
    5. Look for the “Non-canonical page in sitemap” error

    Non-canonical page in sitemap error in Site Audit

    If you see this error, click the error and hit the “View affected URLs” button. You can then take steps to remove these URLs from your sitemap or change their canonicalization status.

    3. Don’t set 404s as canonical URLs

    A 404 status code is returned by the browser when a page or resource cannot be found. This usually happens because the page has been deleted or taken offline. 

    It probably goes without saying that you shouldn’t intentionally specify a 404 as canonical, but this is still a somewhat common error that occurs on websites over time because people often remove or relocate pages. 

    As a result, it’s important to keep an eye out for dead pages marked as canonicals. You can do this for free using Site Audit in Ahrefs Webmaster Tools (AWT).

    1. Create a free AWT account
    2. Add and verify ownership of your website
    3. Crawl your website with Site Audit
    4. Click “All issues” on the left menu
    5. Look for the “Canonical points to 4XX” error

    Canonical points to 4XX error in Site Audit

    If you see this error, you have canonical tags on your site that specify dead URLs as canonical URLs. You can see which pages are affected by clicking the error and hitting the “View affected URLs” button. 

    You should replace any canonical tags linking to 4XX URLs with links to live pages.


    Should I canonicalize paginated pages to the root page?

    If you have paginated pages—such as a series of blog archive pages—these work a little differently than parameterized URLs. In this case, paginated pages should not be canonicalized to the first page in the series. Instead, you should use self-referencing canonical tags on each page. Google’s John Mueller confirmed that this is the correct way to handle canonicalization with pagination on Reddit.

    Is it okay to have multiple canonical tags?

    No, it’s not good practice to have multiple canonical tags on the same page. In this case, Google will most likely ignore both canonical tags and may not index the page.