How to move or transfer Magento from localhost to live server


Normally when developing a Magento site, you will work in Localhost environment like Xampp or Wamp before migrating your Magento site to a live server.  In this Magento tutorial, we will learn how to transfer our Magento site’s code and database from Localhost to a live hosting/server (Read our top 5 recommended hosting with Magento optimization).

There are 5 steps to be done as below:

  1. Export database of Magento site (SQL file)
  2. Upload code of Magento site to live server
  3. Import database to live server and change database configuration.
  4. Replace local URL with live site URL in database
  5. Pointing your domain to server’s IP

Step 1

First we will export database of Magento to SQL file, open your PHPmyadmin program > Select the database you are using in Localhost for your Magento site. From Phpmyadmin menu, select Export, Choose Quick Export and click on Go to start exporting Database.

how to move magento from local host to live server 1

Step 2

Now go to your Magento installation folder in Localhost, select all files/folder and upload it to your live server /www  folder using an FTP/SFTP Client such as: Filezlla, Winscp, CuteFTP (when purchase a hosting or VPS, you will be provided with FTP/SFTP information)

how to move magento from local host to live server 2

Alternatively, If your server is using Cpanel, you can zip your Magento installation folder/files and upload it to www folder of your live server then select the .zip file and unzip it.

unzip extract file in cpanel

If you have ssh access to your server, unzip the file using linux command as below

Step 3

Now we will import database of our localhost to the live server.

Open your live server’s phpmyadmin tool and create a new database (Note username and password of the new database for future use)

create new database for live magento site

Select the new database and click on Import from menu, now choose the .SQL file we got from step 1 to import.

import database to magento

If the import is successful, you will see this message

Next, open app/etc/local.xml on your live site and alter the follow lines:

DBUSERNAME: Username of the database

DBPASSWORD: Password of the database

DBNAME: Name of the database

For example:

Step 4

Next we need to replace localhost URL with live site URL to make the live site work properly. Go to PHPmyadmin on your live server, and select your database using for Magento site.

Find the table  core_config_data  and edit url in column  web/unsecure/base_url and  web/secure/base_url  to the domain of your live site

replace url in magento database

Finally clear Magento Cache by navigating to System > Cache management > Flush Magento cache or simply delete var/cache and var/session folders to make the website run properly

Step 5

Pointing domain to your live server, login to your domain management section, for example godaddy, you will point your domain to your live site by create the following records:

pointing domain to live magento site


Above are all steps needed to transfer/move a Magento store installation from localhost to Live environment, if you encounter any problems during the process, drop a comment here and I’ll be glad to help you out.

Good luck!

How to move or transfer Magento from localhost to live server
5 (100%) 8 votes


About Author

Daniel is a Magento developer with 5 years of experience with customizing Magento extensions, Magento templates. He's main author at Magento explorer

Leave A Reply