What are Canonical URL tags?

Since their widespread support by the major search engines, Canonical URL tags remain one of the most important ways to improve your SEO

Yemi avatar
Written by Yemi
Updated over a week ago

Canonical URL tags - what are they?

Since the widespread adoption and support by all the major search engines dating back to 2008,  canonical url tag have been one of the most important improvements to the way you can improve your site's SEO.

A canonical URL allows you to instruct search engines such as Google, Bing, Yahoo and other interested services such as Snapppt, Pinterest or Facebook, that certain similar URLs are actually one and the same. For instance, it is very common to have a product on your website that can be accessed through multiple urls.

An illustrated example

Let's say we have a fictional store that sells Shoes.
Our store could have all the following urls that relate to the same one item - Red Fancy Shoes.

In some cases, the same item could even be available on multiple domain names. So if our fictional store is localised to multiple languages such as English, Spanish and Japanese, we could also have the following typical urls for the same item:

By using a Canonical url tag, we can consolidate all these duplicate URLs into a single master product page url for Fancy Shoes. For this example, the master Red Fancy Shoes product page is: https://www.my.store/products/fancy-shoes

So we would add a canonical url tag to the product page that looks like this: 

<link rel="canonical" href="https://www.my.store/products/fancy-shoes" /> 

NOTE: The URL in the canonical tag will be different for each product or page on your website. As such, it is usually built into your website theme automatically.

What if my website does not have canonical URL tags?

If the canonical tag is missing from your current theme, you should speak to your theme creator or website host who will be able to advise on how best to add it into your theme.

If you are comfortable making the changes yourself, below are some code snippets you can use to add the Canonical URL tag to your website theme, based on who your hosting provider is.

Note: These code snippets needs to be add within the head of your site's theme template:

    <link rel="canonical" href="URL-GOES-HERE" />

If you are on Shopify: 

you can fix this simply by copying and pasting the following piece of code between the <head> and </head> tag in your index liquid file.

<link rel="canonical" href="{{ canonical_url }}" />


If you are on Wordpress: 

You can follow these easy steps to get canonical URLS into your Wordpress theme.

  1. Login to WordPress

  2. Hover over Appearance

  3. Click Editor

  4. Find Theme Header file header.php 

  5. Add the following PHP Code snippet for Canonical URLS within the HEAD section of your theme header file.
    <link rel="canonical" href="https://YOUR-DOMAIN-NAME.COM<?php echo $_SERVER['REQUEST_URI'];?>">

    NOTE: Make sure you replace
    YOUR-DOMAIN-NAME.COM in the code above with your actual website's domain name.

Alternatively, if this is too complicated, I would recommend using a plugin like Yoast SEO or any other reputable SEO plugin from the Wordpress plugin directory.

Further reading

Did this answer your question?