Bitrix. Add <link rel="canonical"
Битрикс. Добавляем <link rel="canonical"

All English-language materials have been translated fully automatically using the Google service

Adding a canonical link through the settings of the complex component directory

If you have a standard component and template, then most likely you just need to add a parameter to the component call:


Add rel canonical to header.php

Alternatively, a canonical link can be added by cutting off all unnecessary from the url

$page = $APPLICATION->GetCurPage(true);
if (preg_match('/^\/catalog/', $curPage))
    echo '<link rel="canonical" href="' . page . '" />';


<link rel="canonical" href="<?=$APPLICATION->GetCurDir(); ?>" />

Adding a canonical link via catalog component templates

In the result_modifier.php file of the catalog.section component, add at the very bottom:

$arSection = CIblockSection::GetById($arResult["ID"])->GetNext();
$arResult['SECTION_PAGE_URL'] = $arSection['SECTION_PAGE_URL'];

$cp = $this->__component; 
if (is_object($cp))

Add to the component_epilog.php file

$APPLICATION->AddHeadString('<link href="https://'.SITE_SERVER_NAME.$arResult['SECTION_PAGE_URL'].'" rel="canonical" />',true);

In the component template catalog.element , proceed in a similar way. Add

to the result_modifier.php file
$arElement = CIblockElement::GetById($arResult["ID"])->GetNext();
$arResult['DETAIL_PAGE_URL'] = $arElement['DETAIL_PAGE_URL'];
$cp = $this->__component; 

if (is_object($cp))

In component_epilog.php add

$APPLICATION->AddHeadString('<link href="https://'.SITE_SERVER_NAME.$arResult['DETAIL_PAGE_URL'].'" rel="canonical" />',true);


There are no comments yet, you can be the first to leave it

Leave a comment

The site uses a comment pre-moderation system, so your message will be published only after approval by the moderator

You are replying to a user's comment



Email me

Are you developing a new service, making improvements to the existing one and want to be better than your competitors? You have come to the right place. I offer you a comprehensive studio-level website development. From me you can order design, layout, programming, development of non-traditional functionality, implementation of communication between CMS, CRM and Data Analitics, as well as everything else related to sites, except for promotion.

Contact, I will always advise on all questions and help you find the most effective solution for your business. I am engaged in the creation of sites in Novosibirsk and in other regions of Russia, I also work with the CIS countries. You will be satisfied with our cooperation

An error occurred while sending, please try again after a while
Message sent successfully


+7(993) 007-18-96



Россия, г. Москва

By submitting the form, you automatically confirm that you have read and accept the Privacy Policy site

Contact with me
Send message
By submitting the form, you automatically confirm that you have read and accept Privacy policy of site
Sending successful!
Thank you for contacting :) I will contact you as soon as possible
Sending failed
An error occurred while sending the request. Please wait and try again after a while or call my phone number