Migrate Your WordPress Site To A New Host – A 6-Step Guide


Fiona O’Connell


2019 February 12th


If the frustration with your current website host pushes you to make a change, you’ll need to navigate the process of migrating your WordPress site to another hosting provider.

Fear of migrating your WordPress site, and experiencing prolonged downtime or losing content in the process, is often the main reason holding people back from switching hosts.

Thankfully, with a little preparation, the challenge to move your WordPress site to a new host isn’t that difficult to achieve. This is how to migrate a WordPress site:

  • Step 1 - Create a backup of your WordPress site
  • Step 2 - Upload your site to the new host
  • Step 3 - Modify your computer's hosts file
  • Step 4 - Create a new MySQL database for WordPress
  • Step 5 - Migrate your site
  • Step 6 - Change your Doman Name System (DNS) address

1. Create a Backup of Your WordPress Site

The easiest way to create a backup of your WordPress site is by using a backup and cloning plugins, such as Duplicator, All-in-One WP Migration, or Backup Buddy. If you don't wish to use plugins, we also have a very simple guide on how to do a WordPress database backup.

To illustrate the steps of backing up and migrate your WordPress site, I'll use 'Duplicator' as an example, but the process is highly similar regardless of which plugin or method you choose.

Click 'Create New' or the equivalent in your plugin to open up the wizard for setting up a new WordPress backup. Give your backup a name, ideally containing the date of the backup, and then click 'Next' to continue.

Migrate wordpress site duplicator setup

The backup plugin will then run a scan of your WordPress database to check that all content files are present.

If the results look good, continue on to create a zip file containing a backup of your WordPress site and an 'installer.php' file. Creating these files may take a few minutes depending on the size of your website and the amount of content you have.

Migrate WordPress Site Duplicator Scan

Once the backup is finished, download the .zip folder and installation files and save them to your computer.

2. Upload Your Site to a New Host

The next step in transferring your WordPress site to a new host is to copy this zipped backup and the 'installer.php' file over to the new host.

The simplest way to upload files to the new host is by using an FTP client.

Normally, you can connect to your server using your site’s name. But that won’t work in this case because the URL of your site is currently directing traffic to your old host.

Instead, you have to log into the cPanel of your new host and find the IP address and server hostname information.

If you have trouble finding the necessary information or connecting to the new host - contact your new hosting company for help. They should be more than happy to help you migrate.

Once you have connected to your new host, use your FTP client to upload the zip folder and installer.php file that your backup plugin generated to the '/username/public_html/' folder. This is typically the root folder of your new site. In addition, make sure that this folder does not already have WordPress files installed. If they are present, you can delete them for the time being.

3. Modify Your Computer's Hosts File

Now that the backup of your WordPress site has been copied onto the new host, it's time to install WordPress using the 'installer.php' file that you placed in your root folder.

However, you cannot simply access this by navigating to 'www.yoursite.com/installer.php' as you normally would, since your domain is still directing traffic to your old host.

Instead, you can avoid downtime altogether by editing your computer's built-in hosts file. This method essentially tricks your computer into thinking that your website has already moved to the new host, thus allowing you to run the 'installer.php' file.

Migrate WordPress Site Shared IP

Start off by returning to the cPanel within your new host to find the Shared IP address.

For many hosting services, this can be found under the account information section of your dashboard or recovered from your hosting provider.

You’ll then need to edit the hosts file on your computer. On Windows, you can edit the hosts file by right-clicking on your text editor and choosing 'Run as Administrator'. Click 'Yes' on the security prompt that appears, then open the hosts file located at C:\Windows\System32\drivers\etc in your text editor.

On a Mac, you can open the hosts file for editing by opening a command prompt and inserting sudo nano /private/etc/hosts. Once you are able to edit the hosts file on either Windows or Mac, add a line to the bottom that contains the Shared IP address from your new host's cPanel and the web address of your website: ' www.yoursite.com'.

Keep in mind that you will need to replace the Shared IP address with the information from your new host and the web address with the address of your website. Save the hosts file when you’re done.

Keep in mind that you’ll need to undo these changes after you are done moving your WordPress site to a new host, so it’s a good idea to keep the hosts file open and accessible.

4. Create A New MySQL Database for WordPress

Before running the 'installer.php' file, you need a place to store all of the content and files of your new WordPress site. To do that, find the 'Databases' section of your new host's cPanel and select the 'MySQL Databases' icon. Enter a name for your new database and click on 'Create Database'.

Migrate WordPress site MySQL

Next, you will create a user and add it to your new MySQL database.

Find the 'MySQL Users' area within cPanel and then enter a username and password for the new user. When done, navigate to the 'Add User to a Database' section of cPanel and add the new user you created to the new MySQL database you created.

Make sure to write down your new database user information, as you will need that to complete the migration and could need it for WordPress database updates in the future.

5. Migrate Your Site

Now you’re ready to complete your migration to the new host by running the 'installer.php' file. You can simply navigate to 'www.yoursite.com/installer.php' thanks to the modifications that you made to the host's file on your computer. Remember to replace 'yoursite.com' with the name of your site.

Migrate WordPress site Duplicator Database Installer

WordPress's installer wizard will start by running several tests and you can click 'Next' to continue if everything passes. Next, you need to enter the details of your MySQL database, including the username and password you created and added to that database.

The host will be 'localhost'. Click the 'Test Database' button or the equivalent in your plugin to ensure that your database was set up correctly, then click 'Next'.

At this point, your backup and cloning plugin will unzip the archive you initially created of your website and use it to fill your new MySQL database.

When the installation wizard asks you to update your URL and site path, simply leave everything the same. Since the URL of your site is not changing, there is no need to make updates. The wizard will then run a series of final tests, and you can click 'Site Login' to access your the new version of your WordPress site.

6. Change Your Domain Name System (DNS) Address

Your WordPress site has now been successfully migrated to a new host but visitors typing in the URL of your site will still be taken to the old host!

To change that, you have to update the Domain Name System (DNS or nameserver) address of your website.

Migrate WordPress site DNS Transfer

You will need the domain nameservers of your new host, which typically look like 'ns1.yourhost.com, ns2.yourhost.com'.

Login to your domain provider and look around for a nameserver panel. The location of this panel differs between domain providers, but it should be relatively easy to find.

Once you find the nameservers, delete the existing or default nameservers and copy in the two nameservers provided by your new host. Remember to click 'Save' at the bottom of the page to enact your changes.

Changes to the DNS address typically take between 4 hours and 2 days to take effect for everyone visiting your site.

In the meantime, assuming you don’t make any further changes to your site on your new host, visitors will see the same version of your website regardless of whether they are taken to the new or old host.

Cleaning Up After Migrating Your Site

Once you've fully migrated your site to the new host, you can say goodbye to your old host service. To be safe, it is a good idea to wait at least 4 days, and as many as 7 days, after you transfer your WordPress site and your DNS address to the new host before canceling service with your old host.

Also, don't forget to undo the changes you made to your computer's hosts file after your migration.

While migrating your WordPress site to a new host can be frightening, it is straightforward to accomplish and doesn't even require downtime on your site. If you found this guide helpful, please let me know in the comments below!

Leave a Comment

* your email will not be displayed