Back

Canonical URL

What is a canonical URL ?

A canonical URL is a tag inserted in the HTML code of a web page that allows you to specify to search engines the preferred URL, that is,  the one that shoud be crawled.

Why is it important ?

When multiple pages have similar content, search engines consider them duplicate versions of the same page. For example, desktop and mobile versions of a product page are often considered duplicates. Search engines select one of the pages as the canonical, or primary, version and crawl that one more. Valid canonical links let you tell search engines which version of a page to crawl and display to users in search results.

How to define a Canonical URL

Add a <link rel=canonical> element to the <head> of the page :

<!doctype html>
<html lang="en">
  <head>
    …
  
  <link rel="canonical" href="https://example.com"/>
    …
  </head>
  <body>
    …
  </body>
</html>Guidelines for Canonical URLs
  • make sure that the canonical URL is a real valid page
  • use HTTPS canonical URLs rather than HTTP whenever possible
  • don't point the canonical URL to a different domain. Yahoo and Bing don't allow this
  • don't point lower-level pages to the site's root page unless their content is the same
  • use absolute URLs ("https://example.com/page" instead of "/page")