I uploaded all the files from my production website to my staging website which is hosted on a server.

I then uploaded my entire production DB to my staging server. Additionally, I changed the local xml to reflect the new connection strings.

I changed the secure and unsecure urls in the core_config_data table to reflect my staging website URL.

It's still redirecting to my main website. My staging website is a subdomain, I've never ran into this problem before. Does it have anything to do with it being a subdomain?



Could it be something in my htaccess file or other config files?

Any help would be greatly appreciated. Thank you.

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '23181' for key 'PRIMARY'

#0 /home/stage555/public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 /home/stage555/public_html/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /home/stage555/public_html/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#3 /home/stage555/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `lo...', Array)
#4 /home/stage555/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(428): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `lo...', Array)
#5 /home/stage555/public_html/lib/Zend/Db/Adapter/Abstract.php(576): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `lo...', Array)
#6 /home/stage555/public_html/app/code/core/Mage/Log/Model/Resource/Visitor.php(174): Zend_Db_Adapter_Abstract->insert('log_visitor_inf...', Array)
#7 /home/stage555/public_html/app/code/core/Mage/Log/Model/Resource/Visitor.php(108): Mage_Log_Model_Resource_Visitor->_saveVisitorInfo(Object(Mage_Log_Model_Visitor))
#8 /home/stage555/public_html/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(463): Mage_Log_Model_Resource_Visitor->_afterSave(Object(Mage_Log_Model_Visitor))
#9 /home/stage555/public_html/app/code/core/Mage/Core/Model/Abstract.php(318): Mage_Core_Model_Resource_Db_Abstract->save(Object(Mage_Log_Model_Visitor))
#10 /home/stage555/public_html/app/code/core/Mage/Log/Model/Visitor.php(168): Mage_Core_Model_Abstract->save()
#11 /home/stage555/public_html/app/code/core/Mage/Core/Model/App.php(1338): Mage_Log_Model_Visitor->initByRequest(Object(Varien_Event_Observer))
#12 /home/stage555/public_html/app/code/core/Mage/Core/Model/App.php(1317): Mage_Core_Model_App->_callObserverMethod(Object(Mage_Log_Model_Visitor), 'initByRequest', Object(Varien_Event_Observer))
#13 /home/stage555/public_html/app/Mage.php(448): Mage_Core_Model_App->dispatchEvent('controller_acti...', Array)
#14 /home/stage555/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(527): Mage::dispatchEvent('controller_acti...', Array)
#15 /home/stage555/public_html/app/code/core/Mage/Core/Controller/Front/Action.php(64): Mage_Core_Controller_Varien_Action->preDispatch()
#16 /home/stage555/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(407): Mage_Core_Controller_Front_Action->preDispatch()
#17 /home/stage555/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('index')
#18 /home/stage555/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))
#19 /home/stage555/public_html/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#20 /home/stage555/public_html/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#21 /home/stage555/public_html/index.php(87): Mage::run('', 'store')
#22 {main}

3 Answers 3


Check inside your core_config_data table in your database. There is are values called:


Make sure those are pointing to the right domain.

Flush your session storage and var/cache, as it holds url information.

Also, try turning off your auto-redirect to base url setting in System->Configuration->Web->Url Options.

  • I already changed those and i stated that in the above. Thank you for the response.
    – thismethod
    Commented Feb 11, 2015 at 18:24
  • updated to reflect additional options to try. Commented Feb 11, 2015 at 18:38
  • I can't get into admin because it redirects me to the live website, so is there another way to get to the URL options in system configuartion > web > url options?
    – thismethod
    Commented Feb 11, 2015 at 19:03
  • Go into the database and update the core_config_data table. The path is web/url/redirect_to_base. Set this value to 0. Commented Feb 11, 2015 at 19:05
  • i can't flush session storage either because i can't access admin panel because it redirects. I did clear my cache through my ftp my visting the var > cache folder and deleting everything.
    – thismethod
    Commented Feb 11, 2015 at 19:05

No it's not .htaccess When I get that kind of weirdness I simply rename app/ect/local.xml to local_old.xml and rerun first part of installation. Usually it sorts that kind problem :)

  • rerun the first part of the installation as to re-upload all the files through ftp? that will take a long time.
    – thismethod
    Commented Feb 11, 2015 at 19:04

No just Rename local.xml Go to your site url and you Will see magento setup. Enter all details again and you don't need to install anything new local.xml will be created with correct details of your database and url Happy end!

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.