News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Product urls without category

Started by Gipa, February 13, 2013, 02:38:48 AM

Previous topic - Next topic

Gipa

Hi

Many of my products are placed in several categories, and this gives me several addresses for each product.

For example:
www.domain.com/category1/product1
www.domain.com/category2/product1
...
www.domain.com/category8/product1

I would like to remove the category from the urls, so I simply have www.domain.com/product1.

How can I do this?
I looked everywhere and googled it with no luck - I hope someone in here can help.     :)


:)     Rie

LarsK

I have the same problem as @Gipa.  Can anyone help?

Thanks!
Lars

Gipa

Hey Lars

I didn't find a solution for having several addresses, but I created a solution for making them canonical, so they don't annoy Google.    ;)

It's not really an easy solution, as you will need to go through all the products that need canonical rel - but it works...!    ;)

http://forum.virtuemart.net/index.php?topic=113477.msg381658#msg381658


:)    Rie

Peter Pillen

The url build-up is done by components\com_virtuemart\router.php. There is one for joomla (in other directory) and one for virtuemart. But honestly... No idea why you want to remove the category name. You can make good use of this category name for search results.

Gipa

Hi P2 Peter

I know that that is the general opinion in here, but having 5 urls for the same page is a really bad idea no matter how you slice it...
That's duplicate content, and Google does NOT like that...

If I want specific keywords, I can add them to the alias - so SEO-wise there is no problem in not having the categories in the url.

However, I'm told that the navigation will be a problem - that users can't see what category they are in or see the breadcrumbs, if categories are not part of the url.

But when ie osCommerce can make that work, why can't it work in VM2?

Thanks for telling me where to find the routing!    :D
Do you think that navigation and breadcrumbs will break if I remove the categories from product urls? Or do you maybe know a way around that?


:)    Rie

Peter Pillen

I personally don't think you will have a problem with navigation if you remove the category. I assume the sef url is build after navigation... BUT... pagination and breadcrumbs could be an issue

I think you must not remove the category id itself, but you need to remove it the moment the sef url is build. VM2 always makes a non-sef url from all the data ... then makes the sef for each part of the url and then rebuilds that url. Cut out the category the moment the sef url is rebuild would be my best guess. But again... haven't done it myself ... I'm just guessing ;)

Gipa

That makes sense - I think you are right.    :)

Now I just have to figure out what code does what.    :o
I had a quick look at the router.php and I reeeally need some more programming skills to be able to change that code.   ;)
But I'll have to have a look at it - I would really love not to have several urls for the same content.    :)

But then again - I can do without the breadcrumbs, but the pagination is hard to do without...     :-\
Canonical would really be great - but without all the manual labour that comes with my solution.     ;)

Peter Pillen

just a gamble than... in components\com_virtuemart\router.php

comment out this line @ approx line 80 and test it. This code creates the category route segment for the url

if ($categoryRoute->route) $segments[] = $categoryRoute->route;

Gipa

Thanks!    :)
It doesn't seem to change anything though...

I actually think I would prefer the canonical thing - it seems safer in terms of not breaking breadcrumbs, pagination etc.

It would be nice to simply be able to choose the canonical category for each product in backend in stead of having to add a custom field. (Especially since I had to comment out the standard canonical, and that will probably be overwritten when updating VM - so I have to remember to fix that in the future. That might be a "danger"...)

FidelGonzales

Quote from: P2 Peter on March 02, 2013, 23:33:48 PM
The url build-up is done by components\com_virtuemart\router.php. There is one for joomla (in other directory) and one for virtuemart. But honestly... No idea why you want to remove the category name. You can make good use of this category name for search results.
Removal of the category from the URL is the best option for SEO purposes. You'll note that within the default product page template, there is a "Back To: (Category)" link in the top right near the title, which is one way to solve user navigation issue.

Has anyone come up with a simple solution, which does not require hacking of code or a component?