Canonical URLs

If a site has a page available at multiple URLs, or pages with identical or similar content, the Yandex robot may count them as duplicates. In this case, it will combine the pages in a group of duplicates and choose one of them, the most informative and relevant to the search query, to be displayed in the search results. This is called a canonical page.

You can use the rel="canonical" attribute to specify which page to show in the search results. You can also specify the canonical URL if you want to change the site address to use the www prefix or the HTTP or HTTPS protocol.
Attention. The Yandex robot interprets references to the canonical address as recommendations and can ignore them, as is the case with canonical errors.
  1. How do I specify the canonical URL of a page?
  2. How do I change a URL using the canonical address?
  3. Canonical errors
  4. FAQ

How do I specify the canonical URL of a page?

Add the canonical URL in the rel="canonical" attribute using one of the following methods:

Let's say a page can be accessed at two URLs: www.example.com/pages?id==2 and www.example.com/blog.

If the preferred address is /blog, add in the /pages?id=2 HTML the link element:

<link rel="canonical" href="http://www.example.com/blog"/>
Note. Specify the canonical URL in one domain. For the canonical address, give an absolute path, for example http://example.com/blog/.
A page with a rel="canonical" attribute that points to another URL is considered non-canonical.

The robot learns about the changes when it crawls the site. If the canonical URL is entered correctly and the robot doesn't ignore the instructions, the non-canonical page disappears from the search results. To make sure that the page is removed from the search results, check Indexing → Pages in search in Yandex.Webmaster (the Excluded pages block).

The robot ignores instructions if the contents of the canonical and non-canonical page are significantly different. In this case, a non-canonical page may be included in the search. To check this, go to Indexing → Pages in search.

To exclude a non-canonical page that contains GET parameters or tags (UTM, from, and so on) in the URL, add the Clean-param directive to the robots.txt file. Otherwise, use the Disallow directive.

How do I change a URL using the canonical address?

You can enter the canonical address to change the URL of a site:

  • To a domain with or without the www prefix.
  • To use HTTPS or HTTP protocol.

The robot will interpret the canonical address as a redirect to the new main mirror and group the two site versions. To do this, add a link to the pages on the new site with the rel="canonical" attribute in the HTML or in the HTTP header of every page on the old site. For example, you change http://example.com to https://example.com. On the http://example.com/main/ page, include:

<link rel="canonical" href="https://example.com/main"/>

If the attribute points to a different page, the robot might consider this a difference in the site structure. In this case, the site can't be moved.

If you change the URL, make sure that the contents match on the old site and new site. For more information, see relocation instructions.

Note. If the attribute is only added to some pages, it will not point to the main mirror.

Canonical errors

The Yandex robot doesn't consider a URL canonical if:

  • The canonical URL is not accessible to the robot — it redirects to another page or is closed from indexing. This means it can't be included in the search. In this case, a non-canonical URL can be included in the search instead of the canonical URL, provided the robot can access it.
  • The canonical URL points to another domain or subdomain.

  • Several canonical URLs are specified.

  • A chain of canonical URLs is specified. For example, for example.ru/1, the canonical URL is example.ru/2. At the same time, example.ru/2 has the canonical URL example.ru/3.

FAQ

The rel="canonical" attribute points to the page it's located on. Is this an error?

No. If the rel="canonical" attribute refers to the page it's on, the robot considers it canonical.

How do I reinclude a non-canonical page in searches?

If a page was excluded from a search for being non-canonical, it means that the robot found the rel="canonical" attribute with the canonical URL in the HTML. Delete this reference and check that the page you want to include back in the search is not closed to indexing.