Magento – Why Product URL is Duplicating

adminproducts-managementurl

I am using magento 1.7. i am faceing strange problem. magento making duplicate product url with random number with wrong url key please my attached screenshot

I also empty table rewrite_urls and reindex urls but still i am getting wrong urls. please help me to solve this problem. if you are unable to view images in question then please click on links duplicate product urls and Product in admin panel

Duplicate product urls,actual product

Let me make understand u with example

Like i have one product named "example" and url key is "example" Url will be

www.example.com/example

and now i have created new product "xyz and url key is "xyz" and url should be

www.example.com/xyz

but magento generating url

www.example.com/example-123

Best Answer

This seems to be a bug in 1.7. If you have multiple simple products with the same url key as the configurable product (e.g. all names are the same), than magento always creates a new url rewrite on every index process. Example:

First index:

  • myproducturl (config product)
  • myproducturl-id (simple product with its id appended, so far so good)

Second index:

  • myproducturl (config product)
  • myproducturl-randomnumber (simple product with random number, BAD)
  • myproducturl-id --> myproducturl-randomnumber (rewrite to the new url)

And on every new index process the last step will be repeated, so always a new random url key is generated. If magento would check, that a url key with the id for that product already exists, this should be no problem.

After a few months, you will have a really big url_rewrite table, because nothing will be deleted and on every run, at least 1 record for every product with the same url key will be created.

Related Topic