How to migrate Magento Shop to another server

How to migrate Magento Shop to another server

This article explains how to migrate Magento Store to another server. In fact, As a company, there is always a time where you need to do a migration. There are many reasons for you to migrate to the magento store to another server. For examples; you might be tired of your service provider, you might want to move from the dev environment to production ... Whatever being your reasons, follow these steps by steps guides. You don't necessarily need to know much about Magento to migrate Magento. However, you need to understand a little about PHP, MySQL and server configuration.

Steps to migrate Magento Shop to another server

Before you start the migration process, you need to take into consideration the Magento Server Configuration Requirements. In fact, for Magento to function properly on a server, there are some details such as the server performance, the PHP & MySQL versions... that need to be handled. Depending on the version of Magento you are using, I will advise you read the documentation of Magento to find out more about prerequisites. I will also advise doing that out of production hours in case your current store is live. If I assume that you have handled all the prerequisites and your new server is ready for the migration; these are the 7 steps to follow.

Step 1: Backup all your files and folders in the root directory

The idea here is to compress all your Magento Files and folder into the right format supported by your server. For example, In my case, I compress into a .zip or.Tar file. And then download the new compress file into your computer either by using an FTP transfer Protocole or directly.

Step 2: Create a database dump

From your server, generate a backup of your database in .sql format.

Step 3: Create and upload the files/folders backup the new server

Create the installation folder on the new server and point the new URL to that folder. Upload and unzip the backup (.zip or .tar ...) on the folder.

Step 4: Create and import the database

Create a MySQL database on your new server. Note that, if you are familiar with the process of creating a database on your server; the process is the same. For instance, most of the database connexion requires the database name, username, password, and server name. Once your database is created, import your backup database on the new server.

Step 5: Update new database settings

You need to change the database settings to be the same as the new information you created in the previous step. If you are using Magento 1.x open the file app/etc/local.xml and replace the username, database name, password and server name by the one of your new server. But if you are using Magento 2.x, open the file app/etc/env.php and update your database information.

Step 6: Update URLs in core_config_data:

Open the database on the new server and Look for path ="web/unsecure/base_url" and path="web/secure/base_url" in the core_config_data table. And then, update URL to your new store URL.

Step 7: Empty var/cache, var/session, var/report, var/log

If you followed those 7 steps carefully, you should be able to access your website with the new URL. Note that if your plan was to migrate the content and keep the URL; you will need to ignore Step 6 and update your DNS to point to the new server. Or alternatively, you can migrate your domain name. Feel free to contact us if you have any question