Magento – How to we stop a Magento site clone from redirecting back to live site

magento-1.7

We're using Magento Community edition version 1.7.0.2
When we clone, the cloned site always redirects from the clone back to the live site.

We've tried the following two cloning methods:
– using the Clone button in cPanel's Installation to produce a clone on the same server
– porting the entire site to another server
We encountered the same redirect problem with both methods.

How can we stop it from redirecting back to the live site?

Best Answer

Several steps involved in cloning or moving a website.

  1. Copy application files to new location and import database into MySQL. (best to do this with a tarball and database dump sql file, ftp has issues with things like getting .htaccess files to transfer, case to matter, etc.)

  2. (important!!) Make sure file/folder permissions and owner/group are correct so that var/ folder system is writable. Otherwise the Magento cache gets written in system /tmp instead of Magento var/ and only a server reboot or manual deletion will clear Magento cache out of /tmp . Also, not having var/ writable means that any drastic errors that write a file to var/report/ will fail to write any stack traces, compounding your installation heartburn.

  3. Make sure app/etc/local.xml points to the proper database and make sure if you back up the original local.xml that it doesn't end in .xml -> needs to be something like local.xml.sv1

  4. Change your database entries Unsecure BaseUrl for and Secure BaseURL to point to your new location (http://www.example.com and if ssl cert installed https://www.example.com respectively). Use phpmyadmin to look for the paths web/unsecure/base_url and web/secure/base_url in the core_config_data table.

  5. Manually clear your cache by deleting all the mage--? subfolders in var/cache

  6. If you were using the compiler on the previous site, disable compiler with SSH command line php shell/compiler.php disable from the Magento root.

  7. Attempt to load your admin backend, you should be on the new server URL now.

Following these steps should clear all the hiccups that cause Magento to adamantly redirect back to the old server. And believe me, I've had them all happen.

Related Topic