Author Topic: Remove duplicate URL / Standardize Products URL  (Read 6742 times)

TeeJay.net

  • Beginner
  • *
  • Posts: 22
Re: Remove duplicate URL / Standardize Products URL
« Reply #15 on: February 07, 2014, 09:33:44 am »
I have to disagree that multiple URLs (though with canonical) is a feature. It might be a feature for VM, but it's a pain for SEO. The truth is that canonical only prevents penalty from Google (and possibly other search engines), but having 2 or more different URLs for one product still hurts SEO a lot. Why? Because you dissipate the backlinks to your product. Some backlinks may go to one of the URLs created, and other backlinks may go to the other URL. Then, the benefit to your position in google search results from backlinks is lesser.

If you want to remove the category from the URL as I wanted too, here is how to:

Open /components/com_virtuemart/router.php and then find these lines. Then, comment out what's needed as you see in the code below. That's all. Don't forget to purge sef URLs if you use any sef url components.

Code: [Select]
case 'productdetails';

$virtuemart_product_id = false;
if (isset($jmenu['virtuemart_product_id'][ $query['virtuemart_product_id'] ] ) ) {
$query['Itemid'] = $jmenu['virtuemart_product_id'][$query['virtuemart_product_id']];
unset($query['virtuemart_product_id']);
unset($query['virtuemart_category_id']);
} else {
if(isset($query['virtuemart_product_id'])) {
if ($helper->use_id) $segments[] = $query['virtuemart_product_id'];
$virtuemart_product_id = $query['virtuemart_product_id'];
unset($query['virtuemart_product_id']);
}
        /* With the following commented out, category name is gone from URL in all cases
if(empty( $query['virtuemart_category_id'])){
$query['virtuemart_category_id'] = $helper->getParentProductcategory($virtuemart_product_id);
}
if(!empty( $query['virtuemart_category_id'])){
$categoryRoute = $helper->getCategoryRoute($query['virtuemart_category_id']);
if ($categoryRoute->route) $segments[] = $categoryRoute->route;
if ($categoryRoute->itemId) $query['Itemid'] = $categoryRoute->itemId;
else $query['Itemid'] = $jmenu['virtuemart'];
} else {
$query['Itemid'] = $jmenu['virtuemart']?$jmenu['virtuemart']:@$jmenu['virtuemart_category_id'][0];
}
        */
unset($query['virtuemart_category_id']);

if($virtuemart_product_id)
$segments[] = $helper->getProductName($virtuemart_product_id);
}
if (!count($query)) return $segments;
break;
case 'manufacturer';