Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Moving Magento to Another Server
Yaroslav Rogoza Avatar

Here I will outline the easiest process to move your Magento store to a different server/hosting. To perform the move, you should have access to the store files and database.

Step 1:

Clean var directory of your current magento installation to free some space and copy all magento files to a temp directory or directly to the new server. If you want to speed up the process, you should compress all files and extract them on the target server. Also create a dump of your current database and move it to your new server.

Step 2:

Once the files are copied, you should set the correct permissions for magento files and folders:
var and contents should have permissions “777”
media and contents should have permissions “777”
app/etc and contents should have permissions “777”

Restore your old database’s dump into a new database table you are going to use for the new store.

Step 3:

Now let’s set the new database connection settings in the file /app/etc/local.xml:

<resources>
    <db>
        <table_prefix><![CDATA[db_prefix]]></table_prefix>
    </db>
    <default_setup>
        <connection>
            <host><![CDATA[db_host]]></host>
            <username><![CDATA[db_user]]></username>
            <password><![CDATA[db_password]]></password>
            <dbname><![CDATA[db_name]]></dbname>
            <initStatements><![CDATA[SET NAMES utf8]]></initStatements>
            <model><![CDATA[mysql4]]></model>
            <type><![CDATA[pdo_mysql]]></type>
            <pdoType><![CDATA[]]></pdoType>
            <active>1</active>
        </connection>
    </default_setup>
</resources>

You need to replace db_prefix db_host db_user db_password etc.. with your values.

Step 4:

Open a db manager, such as PHPMyAdmin or similar and run the query below:

UPDATE core_config_data SET value="http://newhost.com/" WHERE path="web/unsecure/base_url";
UPDATE core_config_data SET value="https://newhost.com/" WHERE path="web/secure/base_url"

Where “newhost.com” is a new server domain name.

That’s all. Enjoy your old Magento store on a new host. Also if you didn’t clean out your var folder in the previous steps – you should delete the folder var/cache now. If you want to migrate your store from Magento 1 to Magento 2, be sure to read our guide.

Read more: