Whenever I create a new product, Magento automatically creates unnecessary URL rewrites that include each category and subcategory combination, that use the categories' URL keys in the product path. For example, for a product product-name
with the categories:
category
category > subcategory
category > subcategory > third
…Magento will automatically create URL rewrites with the following request paths:
/category/product-name
/category/subcategory/product-name
/category/subcategory/third/product-name
…as well as also creating the in-use URL rewrite with request path:
/product-name
My question is, even though I have the setting Use Categories Path for Product URLs
set to No
in:
System > Configuration > Catalog > Search Engine Optimizations
…how do I stop these additional URL rewrites from being created automatically?
Now, again, I realize that the site isn't linking to these additional paths anywhere on the site, but if for some reason a search engine picked up:
http://example.com/category/subcategory/third/product-name
…this would load! I'm nervous this will result in duplicate content being indexed by search engines. Since the Use Categories Path for Product URLs
setting is set to No
, and all links to the product on the site are pointing to:
http://example.com/product-name
…I want to stop Magento from creating these unnecessary URL rewrites automatically.
For reference, I tried truncating the core_url_rewrite
table to zero (basically emptying it out) and reindexing the Catalog URL Rewrites in System > Index Management
. This still results in Magento automatically creating these unnecessary URL rewrites.
Also, for reference, I am using Magento Community 1.9.1.
Please advise! Your help is much appreciated.
Best Answer
I was actually looking for a similar solution as I have more than 1.5 millions URL rewrites created for 35 000+ products. All of this caused by categories, subcategories but also many store views.
I just found a FREE extension that seems to work on every Magento version (confirmed up to 1.8.1 from the comments)
I'm using the latest 1.9.1 so I will have to test it out but this extension is preventing creation of all subcategories URLs, invisible and disabled products for which Magento also creates URL rewrites for.
Correction: From the comments on Magento Connect it works fine on version 1.9.1.
Please follow this link, all the details are explained in details:
http://www.dnd.fr/2012/09/magento-patch-how-to-optimize-re-index-processing-time-for-url-rewrite/
On Magento Connect:
http://www.magentocommerce.com/magento-connect/catalog/product/view/id/15074/s/dn-d-patch-index-url-1364/category/12863/