How to Move your WordPress Site to a New Host in Simple Steps

Some of the fears people have when trying to move their website to a new host include losing data or making a mistake that will ruin the website altogether.

To prevent this problem, most people would opt to either pay a professional or find a new host that offers the service as part of a new hosting package. However, others would rather create the time to migrate their site themselves.

Ideally, finding a reliable and perfect hosting site for your WordPress site should not be stressful. The process is pretty easy if the right steps are taken.

Below are step by step guides with images on the steps you need to take to move your WordPress website to a new hosting device:

  1. Back up your website files
  2. Make sure to export the WordPress database
  3. Create the WordPress database on your New Host Server
  4. Edit the wp-config.php file
  5. Import your database
  6. Upload the WordPress files to your New Host
  7. Defining New Domain, search and rename the old domain
  8. Cross check
  9. Add final Adjustments

STEP 1: Back up your website files

The first is to back up every aspect of your site. This step is a safe practice and is required for migrating your WordPress installation.

Several plugins can help you backup your site for you, but it is advisable to do your backup manually. Using an FTP program (such as Transmit), connect to your web host and copy all files under your website’s directory to a folder on your local computer.

Files should include the .htaccess file that is set to be hidden. If you need a guide, consult your FTP program that helps display hidden files.

Depending on the number of media uploads you have on your site, this could take some time. While this download is underway, you can begin step two to make a copy of your database.

STEP 2: Export The WordPress Database

Exporting your database is a simple process that only requires a few steps to complete.

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.

Once selected, click on the Export tab on the navigation menu. (The default settings of a Quick export and the SQL format for the export are sufficient for what you need).

When you click the Go button, the database export process will begin, and a file will be downloaded to your local computer.

Once you have the database export and FTP transfer, you are ready to move on to the next stage.

Step 3: Create The WordPress Database On Your New Host Server

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

Login to your new web host with the user credentials they have supplied you with, and connect to the cPanel software.

In this post, we will be using the MySQL Databases application. If your web host does not have that application running, you should contact their support team to discover their method of creating new databases.

Alternatively, you can use the process below

1. Open MySQL Database and create a new database with an appropriate name for your website.

2. Create a new MySQL user (with a secure password).

3. Add this user account to the new database and grant it All Privileges.

Write down the database name, the new MySQL username, and the password for future use.

Step 4: Edit the wp-config.php file

Browse to the folder on your local computer where you downloaded your website files and locate the wpconfig.php that controls the access between WordPress and your database.

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

Open the original version of the file with your favorite text editor and make the following changes:

  1. Change The Database Name

define(‘DB_NAME’, ‘db_name’);

2. Change the Database Username

Below this, you will find the line: define(‘DB_USER’, ‘db_user’);

In this line, you need to change the db_user portion from the username of your old host to match the new username you have created.

3. Change The Database User Password

Finally, edit the third line:

define(‘DB_PASSWORD’, ‘db_pass’);

As with the others, the db_pass section of this line must be changed to the new secure password you created for your MySQL user.

Then save wp-config.php and close the file.

Step 5: Import Your Database

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

Launch phpMyAdmin from the cPanel software on your new server, and select your new database from the list on 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 exported previously.

Un-tick the Partial Import check box, make sure the format is set to SQL, then click the Go button.

The database import will now begin. (The time this import takes varies depending on the size of your database. You should receive a message informing you of the success of the import when it has finished).

Step 6: Upload The WordPress Files To Your New Host

Now that you have the new database prepared and have reconfigured the wp-config.php file, the next step is to upload your website’s files.

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

With the remote directory selected, you can upload your website files that should include the updated version of the wp-config.php.

As with the earlier download, this process can take some time. Also, do not delete these files from your local computer once the upload finishes. They are still needed until the final steps have been completed.

Step 7: Defining New Domain & Search / Replacing Old Domain

If you are moving to a new or different domain, you should read over this step. If not, you can skip this because you don’t have to update your site to point to a different domain.

The usual problem people face with moving a site is that they have added links to other posts on their site or inserted images directly by pointing to a URL on the server. These can cause a break when moving over to a new domain.

If you want to quickly and easily search for any instances of your old domain name to replace it with the new one, it is recommended that you look at the Search Replace DB script on GitHub.

This step will allow you to do this with great ease. Just make sure you DELETE it when you are done (for security reasons). Also, do not place it in your root domain; create a temp folder with a random name to host the script.

Changing Site URL: By searching and replacing the old domain for a new one, you will also be altering the database’s site_url and home url values.

Changing the Site URL will ensure that when you try to log into your site on the new domain, it does not redirect you to the old domain.

Step 8: The Final Touches

There are two steps involved at this stage, and it can take several days before you see the effects.

Before you can use the site on your new host, you must reconfigure your domain’s DNS settings. You need to set it to point to your old host; you also 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 of completing this process are too varied to discuss in this post, but your domain registrar should have all of the details you need to make this change.

DNS changes can take up to 48 hours to propagate fully. It is best to do this at a period when you expect lower levels of traffic. During this 48 hour window, you should avoid making any changes to your website as you may be changing the old version of the site.

After the 48 hours have expired, you should be able to access the new web host when you go to your website. At this point, you can connect to your old web host to delete the files and database.

You should still have a local backup copy of these files, the database export, and the original wp-config.php file if you need to roll back the migration. It is advisable to hold on to these files for some time to be on the safe side.

Conclusion

As you can see, when broken down into the above simple steps, the process isn’t that difficult. All it really requires is for you to be careful at each step and give yourself the option to go back to the original version until the last possible moment (in case of any problems).

Leave a Reply

Your email address will not be published. Required fields are marked *