Moving Magento To A Different Server

There comes a time in the life of a website when it must be moved from one server to another. This transition can be from a development/testing server to a production server or from on hosting-provider’s servers to a different hosting-provider’s server. Whatever the case might be and whatever the reason behind moving your website is, the need to move a website from one server to another is inevitable. Magento websites are no exception.

Here we present to you a list of steps you’d need to follow to get your website working after you have moved it to a different server.

Step 1

Upload your website to the new server and copy the database with its contents intact.

Changing the Database Information

Open magento/app/etc/local.xml  and edit the lines that read:

<host><![CDATA[old db host name]]></host>
<username><![CDATA[old db username]]></username>
<password><![CDATA[old db password]]></password>
<dbname><![CDATA[old db name]]></dbname>

 

to

<host><![CDATA[new db host name]]></host>
<username><![CDATA[new db username]]></username>
<password><![CDATA[new db password]]></password>
<dbname><![CDATA[new db name]]></dbname>

 

Save this file and upload it at the appropriate location on the new server.

Now open magento/app/etc/config.xml  and modify the lines that read:

<host>old_host</host>
<username/>
<password/>
<dbname>old_db_name</dbname>

 

to

<host>new_host</host>
<username/>
<password/>
<dbname>new_db_name</dbname>

 

Clear The Cache And Session Folders

Delete all the contents of the var/cache and var/session folders.

A Couple of SQL Queries to Finish It off

SET FOREIGN_KEY_CHECKS=0;


SET FOREIGN_KEY_CHECKS=1;


UPDATE `core_store` SET store_id = 0 WHERE code='admin';


UPDATE `core_store_group` SET group_id = 0 WHERE name='Default';


UPDATE `core_website` SET website_id = 0 WHERE code='admin';


UPDATE `customer_group` SET customer_group_id = 0 WHERE

customer_group_code='NOT LOGGED IN';


UPDATE `core_config_data` set `value`='insecure_path_to_your_new_store_path' where

`path`='web/unsecure/base_url';


UPDATE `core_config_data` set `value`='secure_path_to_your_new_store_path' where

`path`='web/secure/base_url';

And now, you can visit your new store and revel in its brilliance.

Posted in Magento and tagged , .

Leave a Reply