How to transfer wordpress site to new host
When changing host, or wanting to switch to a new domain, there are a few of acions to do on a wordpress installation in order to have it functioning again with the new configuration.
However, following this guide, it should be pretty easy to migrate wordpress site to new domain !
It is also how to copy a wordpress site from one domain to another, as the original site does not necessarily have to be deactivated.
The process can be summed up to these actions :
1 – Backup and restore wordpress site to new server,
2 – WordPress database migration,
3 – Link wordpress to domain.
1 – How to export wordpress site
First of all, using a FTP client, connect to the server, and download the whole folder containing the wordpress files. This action will take some time, depending on the local and the server connection speed, it might take up to a few hours.
While this action is ongoing, do not hesitate to perform the next step, the WordPress database migration.
The local folder should then contain all files, including hidden files like .htaccess (files with name starting with a dot are hidden files on Linux systems).
2 – Migrate database from one server to another
Go on the old server, open the wordpress database, and select the export action.
There, just make sure that the choosen format is SQL, and click export.
Depending on database size and server speed, a file should be available for download after a few minutes. It contains the wordpress export database, and should be saved on the computer.
3 – WordPress import mysql database
Now, on the new server, open the cPanel web hosting administration or other website administration tool, and find the MySQL Databases. Prior to importing the data, a new database, user, and user access to the database has to be setup.
Here, start by creating a new database, giving it any name.
Then, add a new user, with a good password – mix of letters, numbers, special characters. The password won’t ever need to be remembered, only copy and pasted once, so save it somewhere handy until like an open Notepad++ tab the next step.
And finally, add the user created to the database, with all access, as this user will be the administrator of the database for WordPress.
Now, open the MySQL database in Phpmyadmin, and go to the import option. This is how wordpress import database will happen.
Here, select the file that has been created before, make sure the format selected is SQL, and also uncheck the partial import box. This is especially important for big sites, as the script might sometimes take longer to import the database than it is allowed to run.
By unchecking this box, the script will not stop from importing data in case it reaches the timeout execution, which is what we want to do here.
And of course, start the database import operation by clicking OK.
After the sql import has been completed, a success message should be displayed in phpmyadmin.
4 – WordPress database website
Now that the database is setup, it is time to tell wordpress about this new database, by opening the file wp-config.ini on the local backup. As this file is located in the root folder, it was most likely one of the first files to be downloaded, and should be available even if the transfer is not over yet.
However, if this file is not yet available, simply wait for the transfer to be completed.
There, locate the following lines, and update the database name, database user, and database password with the values from the previous step in cpanel :
5 – Upload wordpress site
If the wordpress data has been downloaded from the old server, it is now time to start to upload local wordpress site to server, still using an FTP client.
This operation will most likely take as long as it took to download the data, so take your time and have a coffee =)
6 – Link wordpress to domain
If you are not changing the domain name, this step is not necessary.
However, if you are moving wordpress site to new domain, from one domain name to another, then all the links have to be updated, to show the new URL instead of the old one.
To do this easily, start with Search Replace DB.
Changing the website URL might be a difficult operation. In case of trouble, refer to the official documentation.
7 – How to transfer a wordpress site to another domain
It should now be done ! However, one step might be missing, which is to configure the new server to be accessible by the URL, which is made through DNS change.
This operation can take up to 24h to be visible, therefore be patient if the URL is not working yet, it might be because the whole internet doesn’t know yet about your new website.
This process, called DNS replication, might take time, until whole internet associates the address of the new website to its domain name.