Two canonical URLs

  • Posts: 120
  • Thank you received: 1
11 years 2 months ago #124590

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

Last edit: 11 years 2 months ago by watashi.

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
11 years 2 months ago #124632

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.

Please Log in or Create an account to join the conversation.

  • Posts: 120
  • Thank you received: 1
11 years 2 months ago #124638

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:

//		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.057 seconds
Powered by Kunena Forum