How to migrate your WordPress site
During the lifecycle of your WordPress site, you may want to change host for a variety of reasons. Especially to take advantage of more features from another host or simply because your current hosting is no longer in line with your growth objectives. You can turn to a web host that offers free migration of a website in general, so WordPress from one platform to another. If, on the other hand, you wish to embark on this exciting operation, we invite you to follow the steps which follow. Do not worry! At first glance, this operation may seem complex, but it is not: just your attention is essential to accomplish a WordPress migration.
Choosing a new WordPress web host
The need to execute a WordPress migration can be due to several situations. Testing, dissatisfaction with the services of the current host, looking for options not available with the current host. Of course, you will first have to choose your future web host. We advise you to read our article for this purpose which will help you choose your web hosting. It would be better so as not to fall into the same dissatisfaction and redo the same operation.
Back up your website files
Migration consists of transferring your website from your current hosting (current folder) to the new hosting. To do this, you will first need to back up your entire website to your local machine. So use an FTP client to export the files. FileZilla is a popular FTP client that you can use. With your FTP credentials, connect to your site. In your folder tree, find the folder for your website (usually this is the public_html / folder) and export it to your computer. Note that the download time varies depending on the size of the folder or files
Export the database
Your website database contains all the components of your site: pages, articles. It will therefore also be necessary to export the database. To do this, log into phpMyAdmin through the control panel of your hosting account. Your databases are in the left menu of phpMyAdmin, click on the correct database, then on “Export” in the top menu. There are two export methods, choose the custom method. The downloaded database will be contained in a .sql file.
Import the database
You are now finished with the starting server. Now go to the destination server for your website. First, you need to create a new database on this server. Now connect to the new server with phpMyAdmin. In the right / left column you will find the option to create a new database. Name it, bearing in mind that a complex name increases the level of security. In order to import the previous database, click on the « Import » button, then on « Browse » to find the previous .sql file. Finally, validate the operation.
Fixing the wp-config.php file
In this step, you will correct the wp-config.php file in order to establish the connection between your new database and your site. Access this file on your machine and update the information for the new database: database name, user name, password and host.
Importing the site to the new server
To do this, connect to the new server with your FTP client. Obviously, you will have to use the login credentials of the new server. Then import the files from your site to the correct folder (again, this is usually the public_html / folder). Then wait while it goes online.
These configurations are useful if your website address or domain name has changed.
- Change of domain name. Navigate to the « wp-config.php » file to modify the following declarations with the appropriate parameters. define (‘WP_HOME’, ’http: //example.com’); define (‘WP_SITEURL’, ’http: //example.com’);
- Changed IP address. Depending on your host, you will either need to change your domain name servers or the DNS « A » record. The procedure to follow will depend on your host. Please contact your web host for more information.
You can also follow this procedure if you want to switch from one sub-folder to another on the same hosting and even if you want to migrate your site locally for tests, for example. There are plugins that make it easier to migrate your WordPress site. However, it’s always interesting to know exactly what the extension is doing automatically.