A Step by Step Guide to Migrating Your WordPress Site to a New Web Host

Moving your WordPress site from one hosting provider can be a long, tedious, annoying process, but what if it didn’t need to be?

Many people are faced with the daunting task of host service migration due to problems with their current provider that just have them fed up. The problem is that many people push off migrating, because they’re afraid of losing time or making a mistake that will damage their site.

Most people will either hire a professional, find a hosting service that does the migration for them, or just do it themselves to get around the problem.

If you spend a little time preparing your own site, migrating is nothing to be worried about. It can be a very straightforward process if approached correctly and can easily be backed out of if any problems occur.

Step 1: Back Up Your Site

FTP-Transfer1

The very first step of any project like this is to BACK UP YOUR FILES. It’s good practice for any project like this, but a requirement of your migration.

There are many plugins available that will back up your site for you. This backup, however, requires a more manual approach. Using an FTP program, such as FileZilla, connect to your web host and copy all the files under the website’s directory to a folder on your computer.

This includes the .htaccess file that is set to be hidden. Check your FTP program’s help file to have it display hidden files if you can’t see the file.

This could take a while, so meanwhile, let’s start step two and make a copy of your database.

Step 2: Export the WordPress Database

Database-Export

 Exporting your database is a really simple process. Login to the cPanel account of your web server and open the phpMyAdmin application. Select the database that contains your WordPress installation from the list on the left hand sidebar and then click the Export tab on the navigation menu.

The default settings of a Quick Export and the SQL format for the export are good for what we need. Click the Go button and the database export process will begin and a file will be downloaded to your computer.

Once the database export and FTP transfer of your files have both finished, you can move onto the next step.

Step 3: Create the WordPress Database on Your New Host Server

Before we begin the migration, we need to create an environment for a WordPress installation. To do this, you need to create a database that you can import your SQL data into.

Login to your new web host with the user credentials they’ve given you and connect to the cPanel software. We will be using the MySQL Databases application. If your web host doesn’t use this application, you should contact their support team to find out their method of creating new databases.

The steps to create a new database are really simple:

  1. Open MySQL Database and create a new database with an appropriate name.
  2. Create a new MySQL user (with a secure password).
  3. Add this user account to the database and grant it All Privileges.

Write down the database name and MySQL username and password. You will need this information soon.

Step 4: Edit the wp-config.php File

Browse to the folder where you downloaded your website files to. In that folder, there is a file called wp-config.php that controls the access between WordPress and your database.

Make a copy of this file and store it in another folder on your computer. This is necessary for restoring the changes we’re about to make should something go wrong.

Open the original file with a text editor and make the following three changes:

1. Change the Database Name

Locate the following line:

[pbcode id=”J5xZcjUZ”/]

The db_name portion of this line will be set to the MySQL database name of your old web host. This must be changed to the name of the new database you just created.

2. Change the Database Username

Below this, you will find the line:

[pbcode id=”RvMULYtf”/]

You need to change the db_user part from your old username to the username you just created.

3. Change the Database Password

Finally change this line:

[pbcode id=”LKhfBLcZ”/]

The db_pass section needs to be changed to the new password you just made.

Save wp-config.php and close the file.

Step 5: Import Your Database

Database-Import1

Now that you have a new database to work with, we can begin the import process.

Launch phpMyAdmin from the cPanel software on your new server and select your new database from the list in the left hand sidebar. Once it opens, select the Import tab from the navigation menu.

In the File to Import section, click the Choose File button and select the SQL file you previously exported.

Un-tick the Partial Import check box, make sure the format is set to SQL, and then click the Go button. The database import will now begin.

The time this takes depends on the size of your database. You should receive a success message once it finishes.

Step 6: Upload the WordPress Files

Now that you’ve got the new database prepared and the wp-config.php file reconfigured, it’s time to begin uploading the site’s files.

Connect to your new web host using a FTP program and browse to the folder where your site will be held. If this is the primary, or only, site being installed on this server, then uploading the files to the public_html folder is the usual directory.

With the remote directory selected, you can upload your files that should now include the updated wp-config.php. This process may take a while.

Don’t delete this files from your computer, even after the upload finishes. They are still needed until the final steps are done.

Step 7: Finishing Up

This step actually has two different things with as much as a few days between eachother.

Before you can use the site on your new host, you will need to reconfigure your domain’s DNS settings. They will be set to your old host and you need to point the correct records to the new server IP address.

This process will depend on where you have your domain registered. The details on this are way too complicated for this post, but your domain registrar should have all the necessary details.

DNS changes can take up to 48 hours to fully propagate. It’s best to do this when you expect low periods of traffic. During this 48 hour window, you should avoid making any changes as these may change your old site.

After the 48-hour period passes, you should be accessing your site from the new web host. You can now connect to your old web host and delete the files and database. You should still have a backup copy of these files and the database export, along with the original wp-config.php file in case you need to roll back the migration. It’s a good idea to hold onto these files for a while, just to be on the safe side.

So as you can see, the migration process isn’t really that bad at all if you do it right. Let us know how your migration experience went!

Source: WPExplorer

Photo Creds: Placeit.net