If you run a WordPress site, you will most likely need to change hosts at some point. In most cases, this is because of growth and the need to scale, but it can also be a domain change or simply needing a better hosting experience. It may seem daunting to move, but using the five tips below will quickly transfer WordPress site to a new host.
1. Backup and Download
The first step before transfer is to back up the database. This can be done through a plugin or by downloading from the backups section of cPanel. After the database file has been saved to the computer, you will need to download your WordPress install through an FTP client such as Filezilla. Just to be safe, you may want to store an extra copy of both the database and the site on a cloud storage service like Dropbox or Google Drive. When everything is backed up, you can go ahead and change your nameservers to point your domain to the new host.
2. Set Up the New Database and Upload Files
One you have the login details for your new web host, go to cPanel and create the new database and user. Make sure to give the user all privileges and create a secure password. The next step is to import the database through phpMyAdmin, which can be accessed through cPanel. On the left side, there will be a link to the newly created database. Clicking this link will present more options, including an import tab. Use this feature to import the mySQL file you saved earlier. If there is a new domain, the site URL will need to be changed by editing the wp_options table in the database. Click wp_options and make the changes to the site URL line. When this step is complete, open your FTP client and upload your WordPress site.
3. Edit the Configuration File
The WordPress configuration file is the heart of your site. After moving the site to a new host, it is likely the database name, username and password will need to be updated. Download the wp-config file to your computer, change the information and upload it to the server. For extra security, wp-config can be placed outside the public_html directory for sites that are running in root. For sites that use a subdomain, setting the permissions to 400 will allow WordPress to read the file and keep it safe from hackers.
4. Domain Propagation and Security
At this point, you may have to wait for domain propagation, which could take up to 48 hours. This is a good time to review the security you are using for WordPress and look at ways to make things better before going live again. The best way to avoid many security issues is by building a strong .htaccess file that will prevent many threats from ever getting close to WordPress. One effective method of preventing brute force attacks is restricting the login page to your own IP address. If you have an IP that changes frequently, you can lock the wp-admin directory with a password. It is also advisable to use a new admin password. Other methods of securing WordPress through .htaccess can be found through a Google search. There is the option of using security plugins, but WordPress will likely run slower.
5. Login and Edit Settings
Once the domain has propagated, you can login to WordPress and change the settings if this is required. Ensure the site URL and blog URL are correct, especially if you are running the blog from a different directory than your install, or it is set up differently than it was on the old host. You should also make sure the time and date settings are right as WordPress often defaults to UTC time. Check the theme to see if all the posts and images imported correctly. If it all looks good, go ahead and put the site back online. You are done.
The steps required to transfer WordPress site to a new host can seem tedious, but they are necessary for a successful changeover. In some cases, the new web host can transfer all the files and settings, but it is best practice and often faster to do the job yourself to ensure there are no errors afterward.