0

I'm looking for solution of how to make the product always have a static URL with category name, no matter from what category I entered. I want URL to always look like this:

http://example.com/category/subcategory/product-name

But instead, I'm getting a bunch of URL's:

http://example.com/product-name
http://example.com/category/product-name
http://example.com/category/subcategory/product-name

I know that I can add canonical URL tag, but it's not an option in this case.

Thank you, any suggestions about from where should I start are very welcome!

1

Found a solution http://www.mikesmullin.com/development/use-categories-product-urls-magento-seo-without-duplicate-content/

Basically, all what's required is to remove this part:

->where('category_id = ? OR category_id IS NULL', $this->_urlRewriteCategory)

From app/code/core/Mage/Catalog/Model/Resource/Product/Collection.php (around line 1100, in function _addUrlRewrite).

Of course you shouldn't modify core files directly and overwrite it from your module.

  • In Magento CE-1.9.0 the code in .../Collection.php no longer matches what you have put. Have you got an updated solution? I am after similar but instead only want the http://example.com/product-name version not any including categories – odd_duck Aug 31 '16 at 16:11

protected by Rajeev K Tomy Apr 2 '15 at 1:05

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.