3

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:

  1. I don't want the ...-1.html or ...-1234.html to be created. How do I prevent getting these "hyphen" links?

  2. The larger problem is that the url_key available in admin and catalog export file display mydomain.com/white-whirt-a.html for this product. When the actual URL is mydomain.com/white-whirt-a-1.html.. What is going on?

  3. When does Magento create a URL rewrite using the product ID? i.e. mydomain.com/white-whirt-a-1234.html

2 Answers 2

0

try to reindex your url rewrite: system > index management [catalog url rewrite]

if you have a lot of product maybe you will get gateway timeout, if that happens you can try to execute it from command line, it is located in: [magentoRoot]/shell/indexer.php

6
  • already tried that many times. Re-index doesn't seem to remove existing rewrites in core_url_rewrites table.
    – laketuna
    Aug 2, 2012 at 0:20
  • do you use any extension? in url rewrite, there is field named type, what is the value? (system / custom / ?)
    – ivantedja
    Aug 2, 2012 at 1:57
  • No extension for URl rewrites. Which URl rewrite are you referring to? Db table, admin menu, or?
    – laketuna
    Aug 2, 2012 at 5:19
  • Both are ok, just the admin menu
    – ivantedja
    Aug 2, 2012 at 5:24
  • Ah yes, they are all "System." No custom rewrites.
    – laketuna
    Aug 2, 2012 at 14:50
0

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.html for 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 table core_url_rewrite will work for a dev site.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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