Website Migration Guides

A simple free resource for website migration

Migrate WordPress 4+ to a new host / server

Quick Guide Steps

Below are the basic steps, full detailed steps are listed further down the page.

  1. Backup your WordPress 4 files/folders
  2. Backup your WordPress 4 Database
  3. Create a new database with your new host and import your WordPress database backup.
  4. Edit your wp-config.php to reflect the new database details.
  5. Upload your WordPress site's files and folders from your backup to the new host.
  6. Update nameservers on domain to point to new host.

wordpress Detailed Guide

In this guide, we will explain how you can migrate your WordPress website to a new host. There are plugins that can do a lot of the migration for you but generally the below is a fool proof way of moving to a new host without having any issues with your widgets, themes or plugins.

Back up

The first step is to back up your WordPress website and database. A lot of hosting companies provide a 1 click back up feature to back up your WordPress website. However, if they don't (or you would prefer to do this manually to make sure everything is correct), we have listed the steps below.

Backing up your WordPress files.

To back up your WordPress files you will need a FTP client. There are many FTP clients available online but in this guide we will be using FileZilla.

You can download FileZilla free from https://filezilla-project.org

To use FileZilla (or any FTP client), you will need the below details:

1. Your FTP host
2. Your FTP username
3. Your FTP password
4. Your FTP port (usually 21).

Your current host should be able to provide you with these (often you can find these yourself via your hosting control panel).

Before connecting, create a new folder on your computer where you will download the back ups to. In this guide we will call this folder 'old host' and create it on our desktop for easy access.

Open up FileZilla and enter your FTP details in the box at the top then click 'connect'.

backup wordpress via ftp

Once connected, double click your WordPress site's public folder. This will likely be called public_html or htdocs (ask your current host if you are not sure).

wordpress public_html

You should now see a list of files.

TIP : Assuming your WordPress website runs when you type in your domain e.g. www.yourwebsite.co.uk, then the WordPress files should now show up. If you have WordPress installed in a folder e.g. www.yourwebsite.co.uk/somefolder, you will need to open that folder (e.g. the 'somefolder' folder) to view the WordPress files.

You can tell if you are in the right location as you should see folders called 'wp-admin', 'wp-content' (plus others) and files such as 'wp-config.php and wp-cron.php'.

wordpress files for backup

In the left hand panel, locate and open the folder where you wish to download the back up of your WordPress website to (old host).

wordpress old host

Next, on the right hand pane, select all the files / folders (they should turn blue when selected).

select wordpress files to backup

Right click on one of the files in blue and select download (alternatively, you can drag the files / folders into the left 'old host' folder).

download wordpress

You should now see a log appear at the top as the files are downloaded to your back up folder (old host). You should also start to see the files / folders appear in the back up folder.

downloading wordpress via ftp

Once complete, you can close FileZilla for now.

Top Tip : Use the 'failed transfers' tab at the bottom to see if any files have failed to upload.

Backing up your WordPress database.

Whilst plugins exist that can do this for you, in this guide we will use PhpMyAdmin to back up the database. The reason for this is virtually every host offers PhpMyAdmin access and the back up procedure should always result in a reliable back up of your WordPress database.

Open PhpMyAdmin (this can usually be found in your hosting control panel under a database section but ask your host for help if you can not find it) and select your database from the left (sometimes it is not required to select the database as it may already be opened automatically).

Select WordPress database

You should see a list of tables now appear including (but not limited to), wp_commentmeta, wp_comments and wp-options. Click the 'Export' tab at the top.

export wordpress database

Click the 'Go' button and save the WordPress database back up file it gives you to your computer.

WordPress export database go

Top Tip : If your database is large, you may find it quicker to click the 'custom' radio button then from the output secion, select 'zipped' from the 'Compression' dropdown, then click 'go'. This will give you a zipped up version of your database which is usually quicker to restore from.

Restoring your WordPress database on your new host

The first step when restoring your website on your new host is to create a new database and import the back up you made in the last step. Usually you can create a database yourself via your hosting control panel but if not, ask your host for instructions and how to access PhpMyAdmin.

Once your database has been set up, make sure you know the following:

1. Your database host name
2. Your database username
3. Your database password
4. Your database name.

(you will need these later on in the guide).

Open up your new host's database in PhpMyAdmin and make sure it is selected in the menu on the left.

new database host

You should see a message saying "No tables found in database".

No tables found in database

Click the 'Import' tab.

Import WordPress database

Click the 'Choose File' button and select the WordPress database back up you downloaded earlier.

Choose WordPress database

Then click the 'Go' Button. Depending on the size of your WordPress database and the host you have decided to use, this may take a while to import.

Go button

Once your WordPress database has been restored, you should see the message "Import has been successfully finished".

Import has been successfully finished

Edit your wp-config.php file

Now that you have restored your WordPress database to your new host, you need to make some changes so when you upload your WordPress files, they are able to communicate with the new database (otherwise they will connect to your old host's database).

Using a plain text editor such as Notepad, open the file wp-config.php in your back up on your computer.

Warning : Do not use a rich text editor such as Microsoft Word or it will damage the file and cause corruption.

You now need to replace some text in this file with your new database details.

Locate the line:

define('DB_NAME', 'AAAAAA');

(yours will have something other than AAAAAA) and update the AAAAAA to match your database name.

Locate the line:

define('DB_USER', 'BBBBBB');

(yours will have something other than BBBBBB) and update the BBBBBB to match your database username.

Locate the line:

define('DB_PASSWORD', 'CCCCCC');

(yours will have something other than CCCCCC) and update the CCCCCC to match your database name.

Locate the line:

define('DB_HOST', 'DDDDDD');

(yours will have something other than DDDDDD) and update the DDDDDD to match your database name.

Then save the file.

Upload your WordPress website to your new host

You can now start the process of uploading your WordPress back up to your new host. You will need your FTP details with your new host (these can usually be found in your control panel or your host can help set FTP access up).

Open up FileZilla and enter your new host's FTP login details across the top, then click connect.

ftp new host

Once connected, open the public folder on the right pane (usually called public_html or htdocs).

public_html folder

Next, open the folder that has the back up of your website (old host).

Old host

Select all the files / folders in the 'old host' folder then right click and select 'Upload'.

upload wordpress backup

You should now see the files being uploaded at the bottom.

restoring wordpress backup

Once the uploads have completed, make sure to check the "failed transfers" tab to make sure no files have failed to upload. Assuming they have all uploaded correctly, you have completed the restore.

Update your domain's nameservers

The final step is to update your domain's nameservers to point to the new hosting company. This step will vary depending on the host you are using but in brief you will need to do the following:

1. Contact your new host and ask them for your hosting's nameservers.
2. Contact your registrar (the company who you renewed / purchased your domain name with) and ask them to update the nameservers to the ones your new host provided. Usually you can do this yourself via your registrar's domain control panel.

That's it, after 24 hours your domain will load up the hosting with your new host.

Comments

If this guide has helped you or if you feel it could be improved, please let us know in the comments below.

Hi, did this site help you?

I'm John and this little website is my online side project. It isn't sponsored by any company and I rely solely on donations to pay the hosting fees. If this site has helped you please consider making a small donation using the link below.

Thanks again and happy surfing.