- Posts: 120
- Thank you received: 1
Two canonical URLs
13 years 4 days ago - 13 years 4 days ago #124590
by watashi
Two canonical URLs was created by watashi
Hello,
On my every page, there are canonical URLs already indicated by default. And the canonical URLs for categories are indicated as: <link href=" www.mysite.com.ua/products/brands/bershka/product/listing " rel="canonical" /> - which is against the structure of my site. I want to change it. How can I do it?
If I put a correct canonical URL into the appropriate field at the category edit page, as result I am getting both canonical URLs in the code of the same page:
<link href=" www.mysite.com.ua/products/brands/bershka/product/listing " rel="canonical" />
and the new one follows below:
<link rel="canonical" href=" www.mysite.com.ua/products/brands/bershka " />
So, how can I remove the first incorrect canonical URL?
-- HikaShop version -- : 2.2.1
-- Joomla version -- : 3.1.1
-- PHP version -- : 5.3.27
On my every page, there are canonical URLs already indicated by default. And the canonical URLs for categories are indicated as: <link href=" www.mysite.com.ua/products/brands/bershka/product/listing " rel="canonical" /> - which is against the structure of my site. I want to change it. How can I do it?
If I put a correct canonical URL into the appropriate field at the category edit page, as result I am getting both canonical URLs in the code of the same page:
<link href=" www.mysite.com.ua/products/brands/bershka/product/listing " rel="canonical" />
and the new one follows below:
<link rel="canonical" href=" www.mysite.com.ua/products/brands/bershka " />
So, how can I remove the first incorrect canonical URL?
-- HikaShop version -- : 2.2.1
-- Joomla version -- : 3.1.1
-- PHP version -- : 5.3.27
Last edit: 13 years 4 days ago by watashi.
Please Log in or Create an account to join the conversation.
13 years 4 days ago #124632
by nicolas
Replied by nicolas on topic Two canonical URLs
Hi,
The first incorrect canonical URL is not added by HikaShop, HikaShop only adds the second one if you specify it in the product/category.
The first one must come from a third party extension which adds it automatically to all the pages so removing/disabling that extension or the canonical URL option of that extension should remove it. It could be a SEF extension or a SEO extension you installed.
The first incorrect canonical URL is not added by HikaShop, HikaShop only adds the second one if you specify it in the product/category.
The first one must come from a third party extension which adds it automatically to all the pages so removing/disabling that extension or the canonical URL option of that extension should remove it. It could be a SEF extension or a SEO extension you installed.
Please Log in or Create an account to join the conversation.
13 years 4 days ago #124638
by watashi
Replied by watashi on topic Two canonical URLs
Nicolas, thank you!
However, I do not have any special SEF plugin/component/module installed.
Indeed, the first canonical URL was inserted by Joomla's core plugin. So, this seems to be a bug of Joomla.
As a workaround, I have edited file /plugins/system/sef/sef.php by commenting the following lines:
Now the first incorrect canonical URL has gone!
This is, however, a core file hack. If anyone wants to implement it, don't forget to put it into your core hack log record.
However, I do not have any special SEF plugin/component/module installed.
Indeed, the first canonical URL was inserted by Joomla's core plugin. So, this seems to be a bug of Joomla.
As a workaround, I have edited file /plugins/system/sef/sef.php by commenting the following lines:
Code:
// if ($uri !== $link)
// {
// $doc->addHeadLink(htmlspecialchars($link), 'canonical');
// }
Now the first incorrect canonical URL has gone!
This is, however, a core file hack. If anyone wants to implement it, don't forget to put it into your core hack log record.
Please Log in or Create an account to join the conversation.
Time to create page: 0.197 seconds