There’s a strange behavior with URL rewrites on our Magento installation, and I’m having a hard time believing there’s nothing wrong with it. FYI, I currently have…
System –> Configuration –> Catalog –> Catalog –> SEO –> Create Permanent Redirect for URLs if URL Key Changed is “No”
Also
I’ve already tried re-indexing URL rewrites from System -> Index Management. This does not seem to remove rewrites that are already in place.
When I upload a product via a data feed, I leave url_key column blank so that Magento can create its own using the products’ names. So, if I upload a product named White Shirt A, it will create a target-to-request path catalog/product/view/id/1234 to mydomain.com/white-whirt-a.html. However, if I completely delete this product from the admin panel, and re-upload the same data feed I used earlier, Magento does not remove the preview URL mapping to mydomain.com/white-whirt-a.html. Instead, it creates a new URL rule to mydomain.com/white-whirt-a-1.html (or sometimes mydomain.com/white-whirt-a-1234.html using the product ID for some reason). Note that in the admin, the product will have mydomain.com/white-whirt-a.html as its URL key, which is not correct.
Some problems:
-
I don’t want the
...-1.htmlor...-1234.htmlto be created. How do I prevent getting these “hyphen” links? -
The larger problem is that the
url_keyavailable in admin and catalog export file displaymydomain.com/white-whirt-a.htmlfor this product. When the actual URL ismydomain.com/white-whirt-a-1.html.. What is going on? -
When does Magento create a URL rewrite using the product ID? i.e.
mydomain.com/white-whirt-a-1234.html
It seems that Magento, or at least our current version, does not remove an URL rewrite once it has been created, no matter what the settings are or whether or not the corresponding product exists in the current catalog. So, if you upload a product with ID 1234 and delete this product later on, the URL rewrite remain in place in
core_url_rewrite. For whatever reason you upload this product again, it will have a new product ID, of course, like 5678, but since the URL rewrite exist from product ID 1234 its name is the same as product ID 1234, you will end up with...-1.htmlfor your new rewrite. I’ve asked Magento to help, but they just don’t quite get what I’m trying to explain.. in the meantime, emptying the tablecore_url_rewritewill work for a dev site.