voodish logo
tweet rss book of faces Linked In

Magento An error occurred while saving the URL rewrite

magento error url rewrite

Fix An error occurred while saving the URL rewrite, quick and easy fix for this problem.

We always recommend making FULL site backups before commencing.

This error normally shows up on a Magento 1.4x installation, the fix we found was to simply to re-index the site:

Admin -> System -> Index Management -> Select All and Reindex

Additional Steps

Added 21/09/2010.

If this doesn’t fix your problem, then try one (or all) of the following

1. Change the permissions of your media folder to 777.
2. Flush your cache, by deleting the /var/cache/ directory *
3. Delete your sessions, by removing your /var/sessions folder *
4. Try replacing your root .htaccess file with a default .htaccess file suitable for your Magento version

*Don’t worry about removing these two folders, they will be automatically recreated once you visit the site again.

Additional, additional steps

Added 30/09/2010.

It would seem that this error message is cropping up more and more for people on 1.4x, whilst using different built in features of Magento, such as multiple stores.

Multiple Stores problem
Thanks to erikedhagen.com for pointing this latest problem out with multiple stores and 1.4x. More information on the fix for multiple stores can be found in the following Magento Forum Thread:

If this didn’t fix your magento error, then please let us know with a message below.

Related Articles

Comments RSS Feed


  1. Colin August 10, 2010

    we have this issue and reindexing all gives the same error.

  2. Go to Top of the page

  3. admin August 10, 2010

    Sorry to hear your having problems Colin.

    Is this a fresh 1.4* install?

    Have you tried:
    Clearing and turning off the cache?
    Also deleting the cache and sessions via FTP.

    Do you have mod-rewrite enabled on your server?
    Are you using Magento URL rewrites from the admin? i.e. no index.php in the URL

  4. Go to Top of the page

  5. kos August 12, 2010

    Thank you for advice. Your suggested did the trick. Running Magento ver. Too bad errors like this are still frequent with the product.

  6. Go to Top of the page

  7. Erik September 21, 2010

    Got the same problem. However, reindexing all data does not solve the problem for me..
    I have no clue of what caused this or how to fix it.

    Please email me if you have any ideas..
    Would greatly appreciate your help on this.


  8. Go to Top of the page

  9. admin September 21, 2010

    Please try any / all of the addtional steps updated in the main post.

  10. Go to Top of the page

  11. Erik September 22, 2010

    Thanks for your response!

    I eventually managed to solve my problem through mostly the same steps you listed here. Setting correct permissions and clearing the cache solved this for me!

    As far as I can tell, for me this problem had to do with setting a custom admin URL through the admin panel (which should be avoided since it messes up your admin, there is a better way to do this).

    Anyway, everything is fine and working for the time being, but probably won’t be for long.
    Well we wouldn’t be working with magento if we didn’t love problem-solving, am I right? ;)


  12. Go to Top of the page

  13. admin September 22, 2010

    Thanks for the update Erik, glad to hear you’ve solved your problem (for the time being at least).

    Yes, Magento is not for the faint hearted! Lots of backups are a necessity.

    Going to be looking at Prestashop soon, as it looks a lot more lightweight and has some really nice features out of the box.

  14. Go to Top of the page

  15. Erik September 30, 2010

    Hmm, it’s interesting you’re looking at Prestashop.
    Most people I’ve heard are all about moving from other platforms to Magento.
    Magento is the first and only ecommerce platform I’ve tried and that’s because of my impression beforehand.
    But I might be revising the alternatives soon as well.

    After all, Magento is pretty heavy for most smaller store needs.

  16. Go to Top of the page

  17. Erik September 30, 2010

    I’ts funny, I just came across this URL rewrite error again.
    This time it seemingly had something to do with creating a new store view.
    I created a new store view and then uploaded a new language pack (the language not being related to the created store view).
    After this, I had the same URL rewrite error again.
    However, this time, cache-clearing and permission-setting did not solve the issue.
    Instead I found a workaround (and possibly root of the problem) in a forum thread here: http://www.magentocommerce.com/boards/main.php/viewthread/198534/#t255791

    In short, Magento is throwing an exception without a preceding error.
    Luckily the fix was really quick and easy, but has to be applied each time the error is shown.

    Well, whatever works! Hope this can help other people stumbling upon this page in search for the solution to this problem.

  18. Go to Top of the page

  19. Emergency Lights October 5, 2010

    Im having this same issue, I did a transfer of all our products from CS-Cart to Magento and all I get is this error when trying to re-index.

  20. Go to Top of the page

  21. admin October 5, 2010

    How did you transfer the products from CS?

    Have you tried any / all of the additional steps in the post? Let us know how you get on.

  22. Go to Top of the page

  23. Coca Tea Shop December 13, 2010

    heelp guys, I tried everything here and my homepage is all broken now - My issue: I mistakenly changed in Config>Catalog>SEO the category suffix from .html to .hml (mouse must have landed there by mistake) and now all my backend is broken and I can’t refresh or flush anything - all buttons do nothing but I can still see everything in ugly broken html - any suggestions?

  24. Go to Top of the page

  25. admin December 13, 2010

    @Coca: Via phpMyAdmin Locate: core_config_data

    Easiest way to do that, is search for:
    “Category URL Suffix”

    Once you find it, EDIT the value (hml to html) and Save.

    This is taking into consideration that your previous working version used html as a file extension… if your previous working version had no extension then remove the entry and save.

    Failing that, do you have a backup of your database?

  26. Go to Top of the page

  27. miki January 2, 2011

    After reindexing. The product got posted and work out fine until I add another item in the inventory. So eveytime I add item, i reindex again.

  28. Go to Top of the page

  29. Gary March 3, 2011

    The fix on the link worked perfectly to fix the url rewrite error, but editing the core is not the best solution but for now, seems like the only solution.

  30. Go to Top of the page

  31. HKS April 1, 2011

    Deleting the cache and session folders solved the problem. Thanks for this.

  32. Go to Top of the page

  33. fischo April 17, 2011

    I did Additional steps
    and I still have “An error occurred while saving the URL rewrite.” when tried Index product and categories URL rewrites Reindex

    pls help

  34. Go to Top of the page

  35. admin April 18, 2011

    @fishco; sorry to hear your having probs, this does seem like a big pain in the Magento.

    Could you let us know which version you are using?
    And whether you have multiple stores?


  36. Go to Top of the page

  37. Ryan October 20, 2011

    Try to truncate the core_url_rewrite table. That worked for me

  38. Go to Top of the page

  39. Bilyana December 12, 2011

    I’m developing a site with Magento 1.6.1. I did a import from OScommerce which creates a new store and new stre view to put all the imported products in. I have deleted all other stores and storeviews i’m not using and i’m left just with one.
    However I get this error “An error occurred while saving the URL rewrite” sometimes (not always) when i try to save a product, reindex the catalog url rewrites. I followed the steps cleaning cache and session folders. I have made the change in Mage/Catalog/Model/Resource/Url.php file where this exception is raised but it’s not resolving my error, it continues to appear.
    Do you have any clue. Could it be connected that i didn’t select t oactivate erver rewrites on install but tried to do it later from admin???
    any help will be greatly appreciated.

  40. Go to Top of the page

  41. Sams March 23, 2012

    I have similar experience as @Bilyana.
    I tried on version 1.6 but nothing works. any idea? Thanks!

  42. Go to Top of the page

  43. Oscpro May 21, 2012

    I have an issue with the oscommerce import was installed on 1.6.2 and now my url indexer is not working. I can manually add urls to the url management section adn they work. But when reindexing, it does not throw an error in the backend, rather it logs an error in the system log file as seen below:

    ERR (3): Warning: Missing argument 1 for Mage_Catalog_Model_Resource_Url::_getCategories(), called in /includes/src/Mage_Oscommerce_Model_Mysql4_Catalog_Url.php on line 7 and defined in /includes/src/Mage_Catalog_Model_Resource_Url.php on line 664
    ERR (3): Notice: Undefined variable: categoryIds in /includes/src/Mage_Catalog_Model_Resource_Url.php on line 671
    ERR (3): Notice: Undefined variable: categoryIds in /includes/src/Mage_Catalog_Model_Resource_Url.php on line 672

    Now my understanding from the 1st part of the error, the system is not able to pull a parent category id.

    If anyone can help with this or tell me how to remove the oscommerce import module, it would be appreciated. I spent all weekend on this to no avail. I tried all of the steps and some other avenues, but nothing works. The indexer works, and comes back real fast and says it indexed. but nothing in the core url rewrite table.

  44. Go to Top of the page

Leave a comment