There are many reasons opt for Magento migration from one server to another, including going live, downgrading to a higher hosting plan, or because your current host does not meet your needs. Whatever the reason, the goal is to have an e-commerce site constantly available, fast and used to propel a business. Migrating a Magento e-commerce site can be tricky at first. However, by carefully following a few simple steps, even a beginner can pull it off.This, while minimizing downtime and possible errors. This article will guide you in this direction so that you carry out this operation.
Requirements for a Magento migration
Before embarking on this task, you should check the points below to ensure a smooth migration. This article is primarily aimed at shared hosting, but easily expands to other situations with some minor changes related to the type of hosting.
- Check that your new Magento hosting plan is compatible with the installation of Magento. Our article on the Magento installation process will help you find out.
- FTP or SSH access and login details for your two hosting services, the old one and the new one. In addition, your web host will provide them to you if you ask them.
If you have both of these, now is the time to get down to business.
How to move a Magento Shop to another server
Backs up your site data
Backing up your Magento site regularly is a highly recommended practice, and especially necessary for migrating your Magento store from one host to another. Before starting, you will have to back up all the files and database of your store on your computer.
If you’re new to the console, don’t worry. Indeed, backups are easily done using documented tools made available by web hosts. Create an archive of all Magento system files located in the public folder of your hosting. Most of the time this is in the public_html folder. You will download this archive to your computer via an FTP client. Do the same with the database, phpMyAdmin is the commonly used tool to manage databases and also generate archives that you can download. If you have SSH access and you know it, do yourself a favor.
Exporting site files
Now you have two archives on your computer, one of your store’s system files and one of the database. In the same way that you downloaded files from your current hosting, reverse the operation on the new hosting.
For the database, it will first be necessary to create a new empty database on the new host. To this database you will need to provide the name, database user and password as well as the privileges of that user. Ideally, try to use the same credentials as the previous host. Thus, you will not have to update the configuration parameters. With the tool at your disposal (phpMyAdmin for example), select the new database created and import the previously created .sql.zip archive.
Updating configuration files
This step is often necessary if you used different identifiers for your database on the new host. You should therefore update this information in order to link your site’s configuration files to the new database. In the case of Magento 2, the file requiring an update is env.php, accessible at <magento_installation_dossier> /app/etc/env.php.
Verification of the migration of the Magento site
Normally, your site should already work, but this should be ensured by checking the different pages of your site. However, you could not directly realize it because your domain name is currently pointing to the old hosting. To work around this, you can use the temporary URL provided by your web host or modify the host file on your computer.
In case you encounter any errors, you can go to the Magento forums where you will certainly get help.
If all goes well, don’t forget to update your DNS configuration so that your visitors can access your site on the new platform.