News:

Looking for documentation? Take a look on our wiki

Main Menu

Remove duplicate URL / Standardize Products URL

Started by conankun, June 10, 2013, 13:06:25 PM

Previous topic - Next topic

TeeJay.net

#15
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.


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';