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


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


but magento generating url

  • You mean the table core_url_rewrite? Commented Mar 25, 2013 at 9:47
  • yes i means core_url_rewrite
    – user482
    Commented Mar 25, 2013 at 10:47
  • It happens because you have/had 2 products with the same url key. Try truncate core_url_rewrite table abd run url rewrites indexer again. Commented Mar 25, 2013 at 22:27
  • no i have checked i have unique url keys and i have already tried this option "Try truncate core_url_rewrite table abd run url rewrites indexer again"
    – user482
    Commented Mar 26, 2013 at 6:47

3 Answers 3


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.

  • This has caused big problems for us. We have 1 product with 20 colour variations and 8 sizes of each, thus we have a LOT of simple products that get imported with the same name. Since the url key is the name if one isn't specified, we end up with many duplicates. The annoying thing is we don't even have simples accessible individually (which makes a mockery of them getting index in the first place). We got around this to a degree by importing the simples sku as part of it's name, since it's not visible on the front end we get away with it. Commented Apr 5, 2013 at 12:24
  • I am also facing this problem, and my URL rewrite table is at over 80,000 entries for a mere 4000 products. If anyone has any further information on this, please let me know.
    – andyjv
    Commented Nov 19, 2013 at 19:59
  • There is an Enterprise Patch that resolves this problem for CE. Commented Jul 31, 2014 at 15:22
  • @brentwpeterson Do you know the ID for that patch?
    – Paul
    Commented Sep 9, 2014 at 14:39
  • 1
    SUPEE_389_EE -- magento.stackexchange.com/questions/32159/… Commented Sep 9, 2014 at 14:52

We have been hit with this bug too. We re-index every day and gained 24,000 URLs in just a few days for around 1000 products.

I believe I may have found a fix for it. I have put this fix live on our production site and will see how it goes. If others can test it would be useful.

  1. In case things go wrong, make a backup of core_url_rewrite table and data

  2. In app/code/core/Mage/Catalog/Model/Url.php line 809 change

    if ($product->getUrlKey() == '' && !empty($requestPath)
            && strpos($existingRequestPath, $requestPath) === 0


    if (!empty($requestPath)
            && strpos($existingRequestPath, $requestPath) === 0
  3. Truncate (empty) the core_url_rewrite table

  4. Under System -> Index Management re-index the Catalog URL Rewrites data

You should now be able to re-index again without creating thousands of random URL rewrites.

Thanks to Jahnni and snowcountry for the fix - read more about it here: http://www.magentocommerce.com/boards/viewthread/416476/

Bug report here: http://www.magentocommerce.com/bug-tracking/issue?issue=15048



This is crazy. Looks like a caching problem!? Something in the indexing process is broken, but no idea, sorry.


I have no idea, why this happends, but I write down my experience and my ideas:

  1. When Magento finds an already existing rewrite, it appends a counting number.

  2. When you change the rewrite, magento creates a rewrite for the old URL (if the checkbox under the text input field is checked).

  3. I think the custom url rewrites are maybe saved somewhere else, so the custom rewrites are applied first and afterwards it is tried to add the product rewrites and if it is not possible, the counter is added?

  • please see my question i have updated it again your post is not usefull for me right now
    – user482
    Commented Mar 25, 2013 at 10:54
  • updated the answer, but not helpful :( Commented Mar 25, 2013 at 14:48

Your Answer

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