VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: conankun on June 10, 2013, 13:06:25 PM

Title: Remove duplicate URL / Standardize Products URL
Post by: conankun on June 10, 2013, 13:06:25 PM
How do I prevent a product to have multiple urls if I assign multiple categories to it?

Example. let say I assigned product "ABC" to "Keyboard", "Digital Piano", and "Musical Instruments" and so I end up with 3 urls to the same product
- http://mysite.com/products/musical-instruments/keyboard/abc
- http://mysite.com/products/musical-instruments/digital-piano/abc
- http://mysite.com/products/musical-instruments/abc

How do I make it so the URL always is http://mysite.com/products/musical-instruments/digital-piano/abc regardless where I enter it from.

This is to reduce confusion, to make it clear to customer what category it actually belongs to, and to avoid getting penalized by search engines like Google for having multiple URLs.

Or better still, is it possible through virtuemart or htaccess rewriting or other methods to default all products URL to http://mysite.com/products/product-name so in this example it would be http://mysite.com/products/abc

Few info that might help:
- I'm using Joomla 2.5.9
- I'm using Virtuemart 2.0.20b
Title: Re: Remove duplicate URL / Standardize Products URL
Post by: Milbo on June 10, 2013, 13:48:41 PM
Please use the latest http://dev.virtuemart.net/projects/virtuemart/files 2.0.21 (D).

The canonical links are fixed there, so you dont get a penalty. Of course the actual category is used, that is desired, for example to change the template, use another layout and so on.
Title: Re: Remove duplicate URL / Standardize Products URL
Post by: conankun on June 12, 2013, 09:06:17 AM
Updated my Virtuemart to 2.0.21d but all the three links are still accessible and the linking is still the same too.

If I click on Keyboard (Musical Instrument > Keyboard), the link to the product is https://www.primanada.com/produk/alat-musik/keyboard-piano-dan-organ/yamaha-dgx-660
If I click on Musical Instrument, the link to the product is https://www.primanada.com/produk/alat-musik/yamaha-dgx-660

What I hope is that all those links be either:
https://www.primanada.com/yamaha-dgx-660 or https://www.primanada.com/produk/alat-musik/keyboard-piano-dan-organ/yamaha-dgx-660

Can anyone lead me to the file where I should edit or the solution to this?
Title: Re: Remove duplicate URL / Standardize Products URL
Post by: Milbo on June 12, 2013, 13:18:07 PM
ehrm, conankun.

That is exactly the TRICK that you can acccess it via different links. In fact there exists with SEF activated almost endless links for one product. This is a feature, not a bug. We use the canonical link correctly, so even you can access it with different links, the search engines know that it is just an alias, because it is announced in the code. Therefore the search engines LIKES it.
Title: Re: Remove duplicate URL / Standardize Products URL
Post by: AH on June 12, 2013, 17:42:43 PM
Hence the term canonical link!

Please conankun read this:-

http://googlewebmastercentral.blogspot.co.uk/2009/02/specify-your-canonical.html (http://googlewebmastercentral.blogspot.co.uk/2009/02/specify-your-canonical.html)
Title: Re: Remove duplicate URL / Standardize Products URL
Post by: conankun on June 13, 2013, 12:21:24 PM
Ah.. Cool thanks.

I have another question on pagination where when I go to page 2 of product categories, it often (not always) remains at page one (although it already has ?start=8). But I'll open up a new thread for that soon.
Title: Re: Remove duplicate URL / Standardize Products URL
Post by: AH on June 13, 2013, 13:25:05 PM
 8)
Title: Re: Remove duplicate URL / Standardize Products URL
Post by: tonis on December 23, 2013, 12:04:10 PM
Hello

I dont think this is a good feature...

What about the social buttons on product? They dont read the canonical url ... so you split likes to more urls if the product is in more categories.

And the same with the social comments - the comments for one product splits to more urls, this is a big problem I think ...
For example, I have disqus comments on products, and if the product are in more categories, the comments splits to more url ....

also when I add categories to menu items, it mess up the breadcrumbs ...

and also, the urls are somehow "slowed", I acces the product form category 1 - it shows url from category 1, then I acces product from category 2, it shows url for the category 1, then I acces it form category 3 and it shows the url from category 2


It would be much better if it works the old way ... to display the product on the category with the lowest id ...  How can this be changed?
Title: Re: Remove duplicate URL / Standardize Products URL
Post by: AH on December 23, 2013, 12:33:11 PM
You don't think canonical urls is a good feature, I have to disagree and so do google!

http://googlewebmastercentral.blogspot.co.uk/2009/02/specify-your-canonical.html (http://googlewebmastercentral.blogspot.co.uk/2009/02/specify-your-canonical.html)

Social buttons are plugins and should be sorted out by the creator of the plugin - this is not a VM issue. Talk to the plugin provider.

Yes there are multiple urls if in multiple categories

Post your problem regarding breadcrumbs as a seperate query and detail the VM version and exactly your problem. "messes up" is not going to get much response

Title: Re: Remove duplicate URL / Standardize Products URL
Post by: tonis on December 23, 2013, 13:12:12 PM
sorry, I dont say it is a VM issue ... I only describe the issues that comes along with it

it was only a statement, I expressed wrong ... I want only to point if it is a necessarily feature for VM


I described the problem here
http://forum.virtuemart.net/index.php?topic=121118.msg413163#msg413163
Title: Re: Remove duplicate URL / Standardize Products URL
Post by: FidelGonzales on January 07, 2014, 08:43:26 AM
I realize this matter has been rehashed upon multiple threads with no apparent solution beyond the use of conical URLs. But is there a method to remove the category from within a product page URL? For social sharing buttons, a single share (or like) on four duplicate page URLs is less likely to go viral than four shares (or likes) on one page URL. Within the Facebook environment, sharing four different pages is less effective to its algorithm, versus when four different people share the same page. Furthermore, four people sharing a single page takes up more real estate upon a person's wall.

CHANGE THIS
mysite.com/shop/category-1/part-1
mysite.com/shop/category-2/part-1
mysite.com/shop/category-4/part-1
mysite.com/shop/category-5/part-1

TO THIS
mysite.com/shop/part-1
Title: Re: Remove duplicate URL / Standardize Products URL
Post by: AH on January 07, 2014, 09:24:51 AM
The category in the URL for a product can be very useful for attracting links and searches

This has been discussed many times

Some people will really want it to have the category when they have multiple categories

If you item does not fit in a single category surely you want people to be able to find that item based on what THEY think it should be described as (Thats why you put it in multiple categories in the first instance , it did not fit perfectly into a single category)

Removing the category will restrict how a product will be indexed by google and thus "longer tail" searches will not return your item

Maybe someone will post a hack, and maybe it will end up as an option in 2.1

But do you really want to reduce your possible hits?

Title: Re: Remove duplicate URL / Standardize Products URL
Post by: FidelGonzales on January 07, 2014, 09:45:34 AM
Thank you for your reply. A configuration option would be ideal.

I understand the potential benefit of long tail searches through the use of multiple URLs. But when considering the aforementioned duplicate URLs concerns, the benefit is relatively small.  SEO copy writing can overcome this quite well. Perhaps the addition of text links back to the categories where the product is published would also be a wise move. This would be used similarly as the "Back To: (Category)" link is used but instead using it more as a tag. It would be interesting to know if publishing a link to the categories where a product is published can be easily done.

There is such an option to eliminate categories from the product URL in Magento. For a 10,000 product database, most products were published in a minimum of three categories with the average being approximately 4.5 (per memory). When switching the option off, the traffic suffered for just over a month but saw an increase in organic traffic just over two months afterward without any additional modifications to the site. The improved load upon the server was noticeable per the logs.
Title: Re: Remove duplicate URL / Standardize Products URL
Post by: Milbo on January 08, 2014, 11:50:46 AM
You can disable the categories in the router.php yourself. VM needs only the product-slug with the suffix (default is -detail)
Title: Re: Remove duplicate URL / Standardize Products URL
Post by: FidelGonzales on January 08, 2014, 21:32:29 PM
Thank you for the advice. I now recall doing this in VM1. I've made multiple attempts here in VM2, removing code from the router.php file. Do you know of any threads or tutorials or have advice to accomplish the desired result?

Some of my experiments on the matter are here: http://mediaarmory.com/forum/229-virtuemart/91517-virtuemart-2-router-php-sef-url-modifications

Thank you.
Title: Re: Remove duplicate URL / Standardize Products URL
Post by: TeeJay.net 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.


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