Magento 1.9.x
The Error from the Error log is as follows:
2020-04-20T23:17:52+00:00 ERR (3):
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'category/112-1-1' for key 'UNQ_MG_CORE_URL_REWRITE_ID_PATH_IS_SYSTEM_STORE_ID' in /home/mywebsite/public_html/lib/Zend/Db/Statement/Pdo.php:228
Stack trace:
#0 /home/mywebsite/public_html/lib/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array)
#1 /home/mywebsite/public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#2 /home/mywebsite/public_html/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#3 /home/mywebsite/public_html/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#4 /home/mywebsite/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `mg...', Array)
#5 /home/mywebsite/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(504): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `mg...', Array)
#6 /home/mywebsite/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(2036): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `mg...', Array)
#7 /home/mywebsite/public_html/app/code/core/Mage/Catalog/Model/Resource/Url.php(300): Varien_Db_Adapter_Pdo_Mysql->insertOnDuplicate('mg_core_url_rew...', Array)
#8 /home/mywebsite/public_html/app/code/core/Mage/Catalog/Model/Url.php(293): Mage_Catalog_Model_Resource_Url->saveRewrite(Array, Object(Varien_Object))
#9 /home/mywebsite/public_html/app/code/core/Mage/Catalog/Model/Url.php(320): Mage_Catalog_Model_Url->_refreshCategoryRewrites(Object(Varien_Object), 'holidays.html/', false)
#10 /home/mywebsite/public_html/app/code/core/Mage/Catalog/Model/Url.php(320): Mage_Catalog_Model_Url->_refreshCategoryRewrites(Object(Varien_Object), '/', false)
#11 /home/mywebsite/public_html/app/code/core/Mage/Catalog/Model/Url.php(461): Mage_Catalog_Model_Url->_refreshCategoryRewrites(Object(Varien_Object), NULL, false)
#12 /home/mywebsite/public_html/app/code/core/Mage/Catalog/Model/Url.php(254): Mage_Catalog_Model_Url->refreshCategoryRewrite('2', '1', false)
#13 /home/mywebsite/public_html/app/code/core/Mage/Catalog/Model/Url.php(248): Mage_Catalog_Model_Url->refreshRewrites('1')
#14 /home/mywebsite/public_html/app/code/core/Mage/Catalog/Model/Indexer/Url.php(257): Mage_Catalog_Model_Url->refreshRewrites()
#15 /home/mywebsite/public_html/app/code/core/Mage/Index/Model/Process.php(212): Mage_Catalog_Model_Indexer_Url->reindexAll()
#16 /home/mywebsite/public_html/app/code/core/Mage/Index/Model/Process.php(260): Mage_Index_Model_Process->reindexAll()
#17 /home/mywebsite/public_html/app/code/core/Mage/Index/controllers/Adminhtml/ProcessController.php(182): Mage_Index_Model_Process->reindexEverything()
#18 /home/mywebsite/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Index_Adminhtml_ProcessController->massReindexAction()
#19 /home/mywebsite/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('massReindex')
#20 /home/mywebsite/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#21 /home/mywebsite/public_html/app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch()
#22 /home/mywebsite/public_html/app/Mage.php(687): Mage_Core_Model_App->run(Array)
#23 /home/mywebsite/public_html/index.php(83): Mage::run('', 'store')
#24 {main}
I tried the following:
- Reindex via SSH. I get a very similar Error:
An error occurred while saving the URL rewrite
- Changed the permissions of our media folder to 777.
- Flushed the Cache, by deleting the /var/cache/ directory
- I was going to delete sessions, by removing the /var/sessions folder but we don't seem to have one
- I tried deleting both entries which had category/112 in the ID path in Catalog -> URL Rewrite Management
I also tried completely deleting the 112 category and deleted the Cache folder through FTP afterwards and ran the reindex via SSH again but the problem just seemed to move to another category now = 164 ?
Next Zend_Db_Statement_Exception: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'category/164-1-2' for key 'UNQ_MG_CORE_URL_REWRITE_ID_PATH_IS_SYSTEM_STORE_ID', query was: INSERT INTO
mg_core_url_rewrite
(store_id
,category_id
,product_id
,id_path
,request_path
,target_path
,is_system
) VALUES (\?, \?, \?, \?, \?, \?, \?) ON DUPLICATE KEY UPDATEstore_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 /home/my store/public_html/lib/Zend/Db/Statement/Pdo.php:235