How to Transfer Magento Site From Localhost to Server

Reading Time: 4 minutes

After you have spent much time building a store by putting up your products in it, and configured the currency rate on your localhost, you are probably happy with the results. But now you want this store to get international popularity, and you want customers from all over the world. To achieve this, you have to upload your store on a live production server so that everyone can reach out to you.

In this tutorial, I am going to do my best to help you transfer your Magento 1 store successfully to the live production server from your PC where no one really sees it except you 😉

Follow this link to learn how to trasnfer Magento 2 site from localhost to server.

Things to Check Before Beginning!

First of all, you have to purchase a domain. We will assume that you own one, but if not, then purchase it from any domain provider.

Getting back to where we were. To upload a Magento store on a live server, here are steps to follow.

Step 1: Export Your Database From Localhost

First of all, login to the phpMyAdmin account on your localhost on PC using any localhost software. It can be XAMPP, WAMP or any other one on which you work. Open up the store’s database. Now at the top of the menu, you will see the option of Export. Hit that option and then hit the Go button, the localhost software will download the database files of your store in the form of .sql extension. Save it as it as or in .zip form. The below picture will make you more clear.


Step 2: Make Your Magento Files in Zip Format

At this step, all you have to do is to zip all the Magento files that you will upload to the live server in a short while. Just go to htdocs folder( if XAMPP) or www folder ( if WAMP) and then go to Magento folder and then compress all the files in the zip folder.

Step 3: Upload Your Magento Files From Localhost to Your Web Server

Next, you have to upload your database to the domain through the cPanel. First of all, login to the cPanel of your live server and then go to phpMyAdmin. Create a new database there.

Here are some important things that you have to note down which includes the database name, username, and password. Just click on the new button and create the database.

Step 4: Import Database  

Now that you have created the database successfully, what you have to do is to import that database which was downloaded from the localhost on your PC into this new database that you have just created.

To do so, select the database that you have created and trace the Import link on the top of the menu. Select it and then at the section Files to Import click on the button Choose File and now choose the file that you dump from your PC. Make sure that the format should be .sql.

After that, click on the Go button. This will take a few moments to import the database.


Step 5:  Upload Your Magento Files

Now, if you want to make a subfolder on your new domain, you can make it. Otherwise, you can work with the normal directory as well. Upload the zip file of the Magento file that you had made in step 3. After you have uploaded it, extract that file there.

Step 6: Change local.xml File for Access Magento System to Your New Database

After you have uploaded the Magento file’s zip folder and extracted it, you now have to make some changes in local.xml file with your directory.

To locate this file go to app/etc/local.xml and then select the local.xml file. Now in your local.xml file you have to change the information that is related to your new database that you have created on your domain. The information includes the name, username and the password that you set while importing the database on your new domain. You now have to locate in the file where this information can be fitted in. You will find that the connection tag has to be replaced with the new one. It will be something like this.





Step 7: Identify Your New Domain Name for Magento System

Now you have to save the changes. If you are editing on the browser, then you have to click the save button in the top right corner of the browser. But if you choose to download and edit the file, it’s now time that you have to upload it again within the right directory.

Go to your Magento database and search Table Core_Config_Data and replace your localhost URL to your Domain name in “web/unsecure/base_url” , “web/secure/base_url”.


Step 8: Clear Cache

Now you have to clear the cache that contains the data from your localhost so that it can have new data related to your newly uploaded Magento store.

To clear up the cache what you have to do is just go to /var/cache and delete all the files and content from there. You can remove by selecting all files and then select the red cross button with label Delete from the menu, and this will delete all the files. You can also delete them one by one by selecting the file and then right-click it and then select delete.

Step 9: Access Your Store

Now if you have done all the above steps successfully, your Magento store is now successfully uploaded on your domain from the localhost. Now go to your browser and then enter your domain name or the public IP of your domain and then hit enter. You will see the frontend of your store if you have done all the above steps as they are mentioned in this article. It will look the same as it looked on your localhost.


Everything is done! This article helps you through uploading your site or Magento store from localhost to any live production server in a very easy manner. All you have to care about is to maintain the backup of everything (database and Magento store files). Now if you want to edit anything, you can do it in the browser or by downloading it. Hope this walkthrough is a good solution for uploading your store.

If you have followed the above steps, it will be very easy to do the job done but if you still have any questions, feel free to ask me or if you want to give your feedback, comment it in the comments section below. Hope this article served you well. 🙂

This is a guest blog post by Fayyaz Khattak – a Magento Community Manager at Cloudways – a Magento Hosting platform.


  1. I have tried the same but still facing some issue
    dbModel read resource does not implement Zend_Db_Adapter_Abstract

    I had already cleared var/cache* and var/session* var permission 777 but still my site doesn’t work and help would be appreciated

    • Manish, thank you for taking the time to leave a comment. Have you checked the articles for Magento 2 stores so far?
      Anyways, you might find the following ideas helpful:
      1. Check the app/etc/env.php configuration file on the remote host. It has data about connecting to the database. There might be errors/typos, etc in it.
      2. If everything is fine with the data in etc/env.php, try to check all the resource models that get inherited from Magento\Framework\Model\ResourceModel\Db\AbstractDb for the correct $connectionName in the constructor. A custom connection might have been specified in one of them (neither default nor null ). This connection could have been present in the localhost, but absent in the one you transfer it to.
      3. If you fail to figure it out or prefer a faster way to check that, there a simple means to debug it. In the vendor/magento/framework/DB/AbstractMapper.php file, on 290 line (approximately), in the setConnection method, replace the code with the following one:

      protected function setConnection($connection)
      if (!$connection instanceof \Magento\Framework\DB\Adapter\AdapterInterface) {
      throw new \InvalidArgumentException(
      (string)new \Magento\Framework\Phrase(
      'Invalid connecton: ' . get_class($connection) . ' Resource model: ' . get_class($this->getResource())
      $this->connection = $connection;

      Thus, in the error text, the class of the ‘wrong’ connection itself, as well as the model source it refers to will be displayed. It will help you obtain the full data for troubleshooting.

      We hope it works for you! =)

  2. Thanks for the information. It really helped me to move my site from localhost to live cpanel server.

    Nice Tutorial!!

  3. Hi Fayyaz i follow these steps accordingly but still facing problem on localhost. After cleaning cache when i saw my front end my Screen appear Blank. i am using Magento 2.2.7

    • Hello and thank you for taking the time to leave a comment. Unfortunately, the described solution works for Magento 1, not Magento 2. Have you managed to deal with the blank screen?

  4. Good Work Fayyaz, You have explained in detail, also I would to share about another awesome guide for migrating Magento Store from cPanel to Cloud Hosting


Please enter your comment!
Please enter your name here