WordPress Migration Documentation
- Confirm access to previous hosting control panel
- Backup MySQL database (preferably using .gz compression)
- Backup public_html (or htdocs) folder to zip file
- Ensure new account hosting cPanel is ready for the website
- Ensure running PHP on latest version
- Upload website files to Encode Hosting
- Recreate MySQL database and add connection details to wp-config.php
- Upload saved database
- Ensure “$table_prefix” (wp_ unique identifier) matches between wp-config and database
- Check if URLs need rewriting
- Run WordPress Updates for Core, Themes, Plugins & Translations
- Check DNS is correctly set
- Check SSL certificate and issued
Introduction
This document has been created to outline the necessary steps in order to successfully complete a WordPress migration from one host to another.
A WordPress migration involves transferring an established WordPress website from one hosting platform to another. These steps follow the migration process from confirming access to the control panel, till issuing the SSL certificate.
They are designed to be streamlined and easy to follow so the process runs smoothly.
Confirm access to current hosting control panel
To begin the migration process, it's important to ensure that you have full access to the hosting control panel where the website is currently situated. The website files (public_html) and MySQL database are stored here so without access, you wouldn't be able to begin the process.
If you have access to the previous hosting control panel, you can proceed to the next step.
If you don't have access to the current web host, you will need to look for a solution via a WordPress plugin. Although this is achieveable, it is possible that you miss some files during the transfer. Always double check.
Tip: The login credentials will be supplied by the current hosting provider so make sure you have obtained these before starting the migration process
Once you've gained access to the previous hosting control panel, navigate to where the database is stored (typically within a Database tab or MySQL Database). Look for a backup option which will allow you to backup and export the database, if possible in .gz compression format as this is a smaller file format and as databases can be heavily compressed this could be the difference between a 300Mb file and a 30Mb one.
If you don't have the option to backup or export the database directly through the control panel, you may have access to phpMyAdmin where there is a feature to export the whole database.
Tip: This screenshot shows typically where a database will be located, allowing you to perform the backup
Now that the database has been backed up, you can go ahead and backup the main website files generally located in the public_html folder. This folder can be usually found in a section such as ‘File Manager’, where you can view all the files that make up your website. Select public_html and choose backup/export/compress and extract the folder into a zip file, which will be used later.
Once the zipped backup has been created, you will need to download this to your local computer.
Tip: This is what the inside of public_html for a WP website looks like so you can make sure its the correct folder
At this stage, it's important to ensure that you can successfully access the clients account and cPanel. This can be found under the Service => My Services => Select Hosting Package => "Log in to cPanel section" of our portal. Once you've confirmed that this is accessible and the hosting package is live, you can navigate into the cPanel and begin the migration.
If you haven't yet got your hosting up and running, click here to see our range of cPanel web hosting plans which all run on superfast SSD's, have a free SSL for every website, and include daily automatic backups
Tip: As you can see here, this is where you can access the clients cPanel (Login to cPanel)
Ensure running on latest version of PHP
The branches of PHP have their own lifecycle and are supported up until certain dates so it’s imperative that you check the latest version of PHP for compatibility and vulnerabilities. Certain features may be deprecated or no longer supported/functional in newer versions. Make sure you read through the htaccess file in public_html too to see if there are any old rules that affect the PHP version.
Tip: Here is a handy link you can use to check the current version of PHP https://www.php.net/supported-versions.php
Once you’ve checked that PHP is running on the latest version, you’re ready to upload the website files and perform the migration. Access file manager in cPanel and navigate to the public_html folder here. Ensure that the files you will upload are the same as the files that are already there, they will just be replaced.
These files need to be in the public_html directory for the www. / root domain of the website.
Now that the website files have been copied across to the correct location, you can recreate the database using the MySQL Database Wizard.
This is a relatively simple process that guides you through the steps to create a database from the name, password, table prefix, and what permissions to apply to the database.
Once the database has been configured, you can navigate back to the public_html folder and add the database name, username & password to your configuration file, in WordPress this is your wp-config.php file, so that the website knows to connect to the new database.
Tip: Each database on a cPanel account will have the same prefix to the database name which will be the username on the server, so the text field that you can fill in will be customising the end of the database name.
Now the database has been set up in the database wizard, you can import the database that we backed up earlier from the previous cPanel. By accessing the PHPMyAdmin section, you can navigate to the database on the left hand side. From here, select "import" at the top and choose your file type. Make sure when importing the database that there are no error messages displayed in the web browser.
A fresh WordPress install database
Ensure “$table_prefix” (wp_ unique identifier) matches between wp-config and database
The table_prefix is a unique identifier used for database tables, added to the start of every table name. By default this is "wp_" for WordPress but Encode adds an extra identifier to make it unique for the client's database. This can also be used to make two separate tables in one database.
Tip: Using a $table_prefix allows you to run multiple websites from a single database
Check if URLs need rewriting
Sometimes URLs may need to be rewritten for various reasons. This means links that were previously active in the site may be broken or unavailable now the migration has taken place. This could also be the case if the site was previously unsecure (http, instead of https), or if we are changing domain during the migration process.
Fortunately, certain plugins can automatically rewrite URLs for you, such as Velvet Blues. The most effective way to rewrite URLs is to utilise WP-CLI in the cPanel terminal, navigating to the directory that the website is installed in and using the following commands:
wp search-replace old_url new_url --dry-run
wp search-replace http://www.example.com/ https://www.example.com/ --dry-run
- If this runs correctly, remove
--dry-run
to commit the actual run
Now that the database is connected, the website files migrated and all of the standard optimisations have been included, it's important to update all standard WordPress files like WordPress Core, your chosen theme and plugins and translations. This can be found in Dashboard => Updates. From here, you can see if any updates are currently available to install. Make sure you look at the version number of each update and patch notes to check for latest additions, compatibility and bug fixes.
Check DNS is correctly set
As one of the last few steps, you should check to see if the DNS and domain has been set up correctly and using the correct nameservers. There are two options for this:
Either use Encode's nameservers:
- ns1.encode.host
- ns2.encode.host
- ns3.encode.host
or:
- Or retrieve IP address from client's cPanel account to point towards our servers
Dig (DNS Lookup) is a useful tool you can use to lookup certain records and nameservers.
Tip: Although you can run dig commands from your computer, this might be quite techincal to get setup. An easier tool to use online is Google's Toolbox which can be found here: https://toolbox.googleapps.com/apps/dig/#A/
Check SSL certificate is issued
As the final step of migration, it's important to ensure the website is secure and has been issued and verified for an SSL certificate. There are two ways to go about this verification process:
- Certification can be requested by DNS, but only if the domain is pointed to Encode nameservers.
- Or, it can be verified by a file being placed in the web directory, depending on which domain it is being authenticated
You can navigate to SSL Status => Run Auto SSL and if verified correctly, all of the domains and subdomains below will show a green lock and a valid SSL certificate.