How to migrate a website from one host to another Print


WordPress Migration Documentation

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

Back to top

Backup MySQL Database (preferably using .gz compression)

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.

 Screenshot of the database section of the cPanel interface

Tip: This screenshot shows typically where a database will be located, allowing you to perform the backup

Back to top

Backup public_html (or htdocs) folder to zip file

Screenshot of file manager

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

Back to top

Ensure cPanel on Encode is ready for the new website

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)

Back to top

Showing how to log into 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

Back to top

Upload website files to Encode Hosting

Default file structure for a new WordPress installation

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.

Back to top

Recreate MySQL database and add connection to wp-config.php

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.

Start of the MySQL database Wizard

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.

Back to top

Upload saved database

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.

Restoring the database
Database layout schema

A fresh WordPress install database

Databse table prefix

Back to top


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.

Config the database table prefix in wp-config.php

Back to top

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

Back to top


Run WordPress Updates for Core, Themes, Plugins & Translations

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.

Screenshot of WordPress update screen

Back to top


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/

Back to top


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.

Back to top


Was this answer helpful?

« Back
Venatour Sports Travel

Encode have continually surpassed themselves in developing our new website. Their patience in learning and understanding what we needed from a website to provide the best service to our customers has been beneficial on so many levels. I would highly recommend them to anyone looking for intelligent solutions to their web, seo or business needs.

Lisa Cooley

Positive: Professionalism, Quality, Responsiveness, Value

Working with Neil is a dream; he's fast, efficient, responsive and full of website knowledge and advice. He won't baffle you with IT over load and will be honest about the best working solution.

Highly recommended!

Ellie Stevenson Author

Positive: Professionalism, Value

Encode and I had a very useful discussion about Wordpress and related issues at no cost to myself. He gave me some very helpful information and answered the questions I had.

I learnt quite a lot! Thank you.

Silvia Boev

Positive: Professionalism, Quality, Responsiveness, Value

I am very excited to work again with Neil. His attention to detail is second to none. I have seen his work in action in the past and he is great. I love his calm approach and his patient guidance to non-tech people like me. I would highly highly reccommend him!

Dr Fuz

Neil is the best! He has sorted out all our business emails and everything runs a great deal better now. Website issues are now a thing of the past as Neil has introduced a maintenance programme to ensure the site is always working optimally and any content changes are actioned pretty much immediately.

Highly recommended!!

H Scott-Brown

'Encode' provided my hosting and domain transfers. They were able to deal with the technicalities of the transfer in a particularly speedy manner, taking all the worry of the transfer, domain issues DNS and nameserver headaches as well as the migration. A couple of emails, and phone call meant it was done smoothly, swiftly and efficiently. All I can say is I'm really please they were recommended to me. Thank you

Spinner