3

I actually have exactly the same problem as posted here An error occurred while saving the URL rewrite after upgrading from CE 1.9.0.0. to 1.9.3.3. I get the error:

An error occurred while saving the URL rewrite

the log file shows me this beautiful piece of work

exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'category/subcategory1/subcategory2.html-3' for key 'UNQ_CORE_URL_REWRITE_REQUEST_PATH_STORE_ID'' in C:\directory

As in the link provided the problem does not lie in a product but rather in the categories. I have tried truncating the index, but this results in a php deadlock which I'm unable to resolve. As the above linked question does not have an adequate answer could someone please enlighten me how to fix this without truncating the core_url_rewrites table. Thank you so much in advance.

  • You deadlock happens when you try to re-index? – brentwpeterson Dec 31 '17 at 14:45
0

Here are two options

You can first try doing this on your local to see if you still get a deadlock. Try reindexing from the command line.

If that still doesn't work

1) Backup your database 2) Test this on a backup database - not live 3) Backup your database and don't test on live. 4) You can delete the record that is causing the issue. I have seen this happen before and you may be entering a rabbit hole.

delete from core_url_rewrite where value = 'category/subcategory1/subcategory2.html-3';

Finally, you can delete everything in your table EXPECT you custom URLs then do a re-index. The only that that won't get automatically regenerated would be custom URLs

0

You can actually look for it under Catalog > URL Rewrite Management once you have seen the error in the exception.log

Next exception 'Zend_Db_Statement_Exception' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'product/7668-1-1' for key 'UNQ_CORE_URL_REWRITE_ID_PATH_IS_SYSTEM_STORE_ID', query was: INSERT INTO `core_url_rewrite` (`store_id`,`category_id`,`product_id`,`id_path`,`request_path`,`target_path`,`is_system`) VALUES (\?, \?, \?, \?, \?, \?, \?) ON DUPLICATE KEY UPDATE `store_id` = VALUES(`store_id`), `category_id` = VALUES(`category_id`), `product_id` = VALUES(`product_id`), `id_path` = VALUES(`id_path`), `request_path` = VALUES(`request_path`), `target_path` = VALUES(`target_path`), `is_system` = VALUES(`is_system`)' in /var/www/magento/lib/Zend/Db/Statement/Pdo.php:235

Once you have found it, click on one of the duplicates and on the edit page you can delete it from there.

Then reindex by either:

  • The admin panel Index Management or
  • cli php shell/indexer.php --reindex catalog_url
0

in my case i had to make core_url_rewrite url_rewrite_id row auto increment

ALTER TABLE `core_url_rewrite` CHANGE `url_rewrite_id` `url_rewrite_id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Rewrite Id';

this is because of an error during importing of the database

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy