VirtueMart Forum

VirtueMart 2 + 3 + 4 => Security (https) / Performance / SEO, SEF, URLs => Topic started by: mediacompadova on March 02, 2016, 16:18:24 PM

Title: Duplicate Products Url and wrong rel="canonical"
Post by: mediacompadova on March 02, 2016, 16:18:24 PM
Hi everyone,
I've this huge problem. I'm italian, sorry if i can't speak english well at all.
http://couponviaggio.it/ This is a travel company site, with virtuemart, and it has many seo problems.

Products that belong to 1+ categories, have duplicate URLs. For example:
http://couponviaggio.it/regioni-italiane/regione-abruzzo/hotel_city_montesilvano-detail.html
http://couponviaggio.it/mare/vacanze-mare-abruzzo/hotel_city_montesilvano-detail.html

This is the same product, but it is reachable by 2 URLs, and this create a duplicate.

At this point i think, maybe the rel="canonical" is set to one url for both URLs. But it's not so.
This is for the first:  <link href="http://couponviaggio.it/regioni-italiane/regione-abruzzo/hotel_city_montesilvano-detail.html?limitstart=0&amp;limit=int" rel="canonical" />
This is for the second: <link href="http://couponviaggio.it/mare/vacanze-mare-abruzzo/hotel_city_montesilvano-detail.html?limitstart=0&amp;limit=int" rel="canonical" />

The canonical URL is the URL where you are in! And it has no sense.
What i have to do for fix these problems?
Thank you, and have a nice day!
Title: Re: Duplicate Products Url and wrong rel="canonical"
Post by: Ghost on March 02, 2016, 18:35:58 PM
What version of VM is that? 3.0.2? I suggest you update first. There are some canonical URL changes in more recent versions.
Title: Re: Duplicate Products Url and wrong rel="canonical"
Post by: Studio 42 on March 03, 2016, 02:34:26 AM
You have another problem :
in your html header:
eg.
<link href="http://couponviaggio.it/mare/offerte-mare-italia/hotel-le-torri-arborea-detail.html?limitstart=0&amp;limit=int" rel="canonical" />
  <link href="/mare/offerte-mare-italia/hotel-le-torri-arborea-detail.html" rel="canonical" />


And all 2 are bad !
First have all and second is better using full link(but second is better)
So i think perhaps your template or a plugin (or SEF tool) add the first one, because second one is generate by virtuemart.
Title: Re: Duplicate Products Url and wrong rel="canonical"
Post by: GJC Web Design on March 03, 2016, 10:22:57 AM
As Ghost said.. are u using VM3.0.12+ as there has been work done on this area recently
Title: Re: Duplicate Products Url and wrong rel="canonical"
Post by: sandomatyas on April 02, 2016, 07:14:12 AM
I have this problem too. There are two different canonical urls, the first one is absolute and the right one, the second one is relative and wrong.
Joomla version is 3.5.0, VM version is 3.0.14
I checked the source and found this in views/productdetails/view.php.html:

// remove joomla canonical before adding it
foreach ( $document->_links as $k => $array ) {
if ( $array['relation'] == 'canonical' ) {
unset($document->_links[$k]);
break;
}
}

// Set Canonic link
if($isCustomVariant !==false and !empty($isCustomVariant->usecanonical) and !empty($product->product_parent_id)){
$parent = $product_model ->getProduct($product->product_parent_id);
$document->addHeadLink( JUri::getInstance()->toString(array('scheme', 'host', 'port')).JRoute::_($parent->canonical), 'canonical', 'rel', '');
} else {
$document->addHeadLink( JUri::getInstance()->toString(array('scheme', 'host', 'port')).JRoute::_($product->canonical), 'canonical', 'rel', '');
// }


The problem is that $document->_links is empty at this point.
The reason is that Joomla 3.5.0 moved it's canonical url handling from onAfterRoute() to onAfterDispatch() in the sef system plugin.

Also checked the issue in Joomla! Issue tracker and found that 3.5.1 will solve the problem: https://issues.joomla.org/tracker/joomla-cms/9565
I checked the patched version and seems a solution so all we need is wait for Joomla 3.5.1 :)