Changing web hosting providers is not something you should have to do often, but when you do have to switch hosts, it’s important to take all of the necessary precautions. Below, you will find a comprehensive guide on how to change web hosting providers safely and efficiently.
Backup your website’s files
Backing up your website files should be something you do regularly, even if you are not going to switch hosts. Be sure to take one last backup by logging into an FTP client like FileZilla. Once you’ve downloaded and connected to your web hosting, access the folder that your site is stored in and download the files to safe location on your local computer. CPanel and other hosting control panels will often provide 1 click solutions for taking website file backups, so this is an alternative option.
Backup your website’s database
Downloading a backup of your website’s database is even more important than having an up to date backup of the files. The database is where posts, pages, users, settings, and comments are typically stored. For websites run off of the WordPress CMS, this is where the bulk of your website’s data comes from.
To take a backup of the database just login to cPanel by going to yourdomain.com/cpanel and find the “PHPMyAdmin” section. Upon clicking this, you should be directed to a page that lets you view the content of your databases. After you click on the database for your website (which should be displayed on the left hand side) you can then click on “Export” which will allow you to export the database into a file that will be stored on your local computer.
Upload the website files to your new host
It’s now time to take the backup that you took of your website’s files and upload those files to your new web host. You can do this through FileZilla as well, you simply connect to your new host and reverse what you had done before by uploading the files from your local computer to your new web host.
Import the database and change the website’s database settings
At this point, you need to create a new database within the new web host. Login to cPanel and create the database with a new username and password. Then, go to PHPMyAdmin again and import the database backup that you took into the new database. The last step to complete is to find the file within your website that specifies the database details. For WordPress, this is a “config” file but it could be different for your website. Change the details so that your website can connect to your new database.
Repoint the name servers (DNS) of your domain
The last step to ensure everything has been completed properly is to login to your domain registrar and point the name servers (DNS) of your domain to point to the new web host. After the DNS propagates, you will be able to access the domain and it will now be officially hosted on your new web hosting provider.