Answer the question
In order to leave comments, you need to log in
How to spell canonical?
It is necessary that canonical be displayed only on the main page. Did it like this:
$currentUrl = "https://" . $_SERVER['SERVER_NAME'];
if($currentUrl == "https://www.my-shop.com") {
$APPLICATION->AddHeadString('<link rel="canonical" href="https://www.my-shop.com/" />');
}
Answer the question
In order to leave comments, you need to log in
Did it like this:
$val = $APPLICATION->GetCurPageParam("", array_keys($_GET), false);
$APPLICATION->SetPageProperty("canonical", $val);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question