Move WordPress to a New Host

Reading Time: 3 minutes

Transferring a website on your own may seem a bit daunting at first but there is no need to be this way.

Surely, a moment will come when you will need to move your website from one hosting company to another. The reasons vary and maybe from poor hosting infrastructure and bad support to a nice offer from the new place but this is not the main theme of the article and we will not be taking time to further discuss it.

So, how can you transfer your site in several simple steps? Just follow along:

1) Make a backup of your site’s database. This can either be made by the phpMyAdmin tool and using the Export option or by using the WP-CLI command ‘wp db export’ executed via terminal from the document root folder of the website to export the database. Then you can download it locally on your device either using an FTP client or the command-line tool ‘scp’

2) Make a backup of your website’s files. If you are using cPanel you can make this via the File Manager, then go to the website’s document root folder, use the Select All option and then using the Archive option zip all the files. You can then download the archive locally. This can be done by right-clicking on the file, then press Download. Another option will be via FTP. We recommend using the popular FTP client FileZilla. You will need to have an active FTP account, then log into the server, go to the document root of the website and download the files locally or if you have already created an archive file you will only download that one archived file. Please note that if you have not made an archive initially and your site has a large number of files then the download process might take a while.

  Error Establishing A Database Connection

3) Now we move on to the new host. First, you will need to create a database on your new host, and also a database user and associate this database with the user. The process here can vary depending on the new hosts’ interface and software used.

4) Upload the backed up website files onto the new host and into the document root folder of the site. Again this can be made in several ways – via FTP is the most common way; you can also use the command-line tools such as ‘scp’ and copy the files from your device to the new host’s document root folder

5) A very important step is to update the wp-config.php file with the details of the newly created database, the new DB user and password and the new server (if there is change)

6) Once you have uploaded the files and you have created the new database and edited the wp-config.php file then you need to Import the backed up database. This can be done in several ways. If the new host is using the phpMyAdmin then you can open phpMyAdmin, navigate to the new database and use the Import option. But please note that there can be some limitations on the size of the imported file. Another option will be to upload the backed up .sql file into the new document root and to use the WP-CLI command ‘wp db import file.sql’.

  Fatal Error in WordPress

7) Changing the domain. If your site will use the same domain you can skip this step. But if you intend to change the domain of the website then you can now safely do it by either using the WP-CLI command ‘wp search-replace’ of by using a plugin that will do this for you. As WordPress is a domain-dependent CMS you will need to make sure that you have set the new domain to the Home URL and Site URL and also that you have replaced all occurrences of the old domain in the database.

8) Now you are all done. You can test the site on the hosts by using the hosts file and once you are okay with the new setup you can then proceed and update the DNS. You will need to either point the domain via A record or alternately change the name servers of the domain to the ones used and recommended by the new host.

Inquire About Move WordPress to a New Host

Share us all the details you have so we can start working on your WordPress website immediately!