Magento 1.7 – Always Show Full URL Including Categories for Product

catalogcatalogsearchmagento-1.7seourl

For our Magento webshop (1.7.0.2), we're trying to optimize the URL structure. We've already managed to improve some things, but in one things we didn't succeed. We want to use a full URL (including categories) for all of our products. For example:

  • www.website.com/products/best-products/product
  • or: www.website.com/products/best-products for a category page

This works fine when browsing through the categories and using the breadcrumbs, but not when searching. It then always uses www.website.com/product as URL, most likely because a product can be in multiple categories and it doesn't know which category to use in the search results.

Is there a way to force this? To make it somehow use the "first" category, or even make it use some default category that you can pick? I'm a developer, so I'm willing to make changes to the code, but only if there isn't another/more reliable way. Any tips or tricks are welcome, many thanks in advance!

Best Answer

What you want can't be achieved - afaik.

The problem is, that magento is planned with "product in many categories". The problem now is magento doesn't prefer any category and instead it shows no category at all.

The categories are used, when you click throught the categories, this is the only place (afaik) where the category rewrites are used.

But I think you can achieve what you want, by hacking a little bit the rewrite system and just make sure to load a category rewrite and not the one without all categories.

The next problem then is, that you have to make sure, that google still gets every time the same canonical url or you'll get a problem with duplicate content...

And the last think I have in mind: I'm not sure, wether this is a good idea from a SEO point of view. I'm no seo expert, but some one said to me, the shorter the url, the better...

Related Topic