Posts Tagged ‘changing magento directory’

Migrating Magento from Local to Live or Live to Local

December 6, 2010

Changing the Magento Directory or Server Location

Knowing how slow Magento can be when working in the admin area, it’s preferable to work locally when updating the content of the store. The trick then is to upload the entire store and data to a live website.

Having finally achieved this, here’s how I managed it manually without having to change any information in the admin area (except for the initial product backup).

Make a backup in the admin area

In the admin area of your local site (assuming that you are migrating to a live site), visit System/Tools/Backups. Click the Create Backup button. A new backup should appear at the top of the list. Download it and decompress it by clicking on the gz or 7-Zip link.

Import the data to your destination server

Now open phpMyAdmin on your destination server. If you’re migrating to a local site and working on a Mac then installing MAMP is the best thing to do here. For PCs, visit this link for phpMyAdmin installation instructions.

Create a new database and user using exactly the same information you used when installing Magento for the first time. Select the database in phpMyAdmin and click the Import tab. Browse to your decompressed data file, select it for upload and click Go.

Edit the core_config_data Table

Find the table called core_config_data in the list of tables shown on the left of phpMyAdmin, click it and then click Browse. Remember that if you opted for a prefix for your tables then the table name will be yourprefix_core_config_data.

Find the field web/unsecure/base_url and change the associated value from your existing directory destination to your new one. Remember to include http:// at the start and a trailing / at the end.

Now find the field web/secure/base_url and change the associated value in the same way.

Edit the local.xml file

Finally you need to edit the new MySQL host and database details in the local.xml file. Open app/etc/local.xml.

Change the host and database details as appropriate if necessary. You might find that the details remain the same, but in my case I had changed the localhost to the new server name as well as the database name, user and password, all of which were assigned or restricted in length by my live server.

If you’ve performed a separate install on your destination server already and want to change the data, you need to also insert the appropriate website key here as well.

Check and remember your admin directory name for reference if you’ve changed it from the default admin.

Upload the amended file and that should do the trick.