Magento Fixes: An Error Occurred while Saving the URL Rewrite

Sometimes while doing a Reindex in the Admin Panel you will get the error “An error occurred while saving the URL rewrite.” Now, while there are numerous fixes to this issue, I found one that I felt best addressed the issue and corrected it quickly with minimal effort.

If you tried to reindex any of the other index’s past Catalog URL Rewrites, those will fail as well, but do not confuse those not indexing with the Catalog URL Rewrite. If you try to reindex those separately they will still work as the issue only lies with Catalog URL Rewrites.

Magento-Egfhfdhrror-URL-Rewrite-2
Error! Error!

Now to fix this issue you will need to truncate your core_url_rewrite table.

Magento-Error-cvsxczURL-Rewrite
Ahhh. Fixed!

To truncate the core_url_rewrite table without getting this bunk Magento error, take the following steps.

  1. To access the table, open either your SVN or Terminal depending on which OS you are on.
  2. Once you’re in, you will need to SSH into your development or production box and “cd /user/bin/”
  3. Log into mysql “mysql -u username -p password.”
  4. Show all the current databases “show databases;”
  5. Now you should only have the one database for your website, but if this is on a Dev or Local environment, you will have multiple databases.
  6. Once you have figured out which database you need to use by checking the local.xml, use the following command in mysql “use db_name;” where db_name is the name of the database you want to change.
  7. Now that you are in the correct database you are having the issues with you will want to run this command “truncate core_url_rewrite;”
  8. To check that it worked run this command “select count(*) from core_url_rewrite;” it should come back that it is 0.
  9. Now go into the admin panel and reindex your Catalog URL Rewrites. At this point, it should work without an error.
  10. If you want to be extra-sure it worked, you can go back to your Terminal or SVN and go back to the sql table and run the “select count(*) from core_url_rewrite;”. This time it should return a much higher number then 0.

That’s all it takes to fix the Catalog URL Rewrite index error in the admin.

Boom.

Picture of Human Element

Human Element

Human Element is an eCommerce services and digital marketing agency based in Ann Arbor, MI. Founded in 2004, Human Element has been delivering eCommerce solutions, custom integrations, and digital marketing solutions for 20 years.
Share the Post:

Like what you’re reading?

Get access to our newsletter for occasional eCommerce news and insights. Opt out at any time by unsubscribing.