How to Migrate Your WordPress Site to a New Host?

Are you trying to learn how to migrate your WordPress website and move to a new host or server? If yes, then you are in the right place!

Although many users find moving their website to a new host challenging, the process can be surprisingly straightforward. All popular web hosting services now offer free migration to the new hosting. If you don't have such a facility available or have already used one allotted to you, you can use this guide to do the process on your own.

Don't worry. Migrating a website from one hosting provider to another can be a bit intimidating, but it can be a smooth process with the right guidance.

Reasons to Migrate a Website

You might want to migrate a website to a new hosting provider for several reasons:

  1. You are looking for better performance: If your website is experiencing slow loading times or frequent downtime, you must switch to a new web host that can provide better performance and reliability. Note that website performance is now an SEO factor, and slower websites tend to rank low, get less conversion and fade out of business. (I have been there.)
  2. You are fed up with the lack of support: If you're unhappy with your current web host's customer support, you may want to switch to a new provider that can offer better support and help you resolve issues quickly.
  3. You are having budget issues/budget upgrades: There may be two cases in this. First is that you're paying too much for your current web hosting plan. Switching to a new provider offering more affordable plans with the same or better features can save you a lot of money. One more reason to switch can be the recent budget upgrades, say, you have been making more money and now you want to spend more, and you need access to new features that your current web host doesn't offer.

In short, you need to move to a new host because you need better hosting.

However, I have seen users and businesses all too often that they kept delaying migrating to a more reliable host due to their fear of making mistakes and damaging their WordPress websites.

I have been there too. But don't worry now, as I say again that most of the hosting services now offer free migrations. And if your one doesn't, you can use this guide to migrate your WordPress site to a new host easily.

Migrating can be really easy and straightforward if you take the correct approach and dedicate little time to preparing your website. Also, you can quickly reverse out of it in case of any problems.

I have enlisted all the crucial steps to migrate your WordPress website to a new host in this guide.

However, before starting, I repeat that the most reliable WordPress hosting companies will move your website for you. Be sure to check for that first.

Done? Not let's go with the do-it-yourself treatment and migrate WordPress site to new host manually using my step-by-step guide.

Step by Step Guide to Migrate Your WordPress Site to a New Host

Step by Step Guide to Migrate Your WordPress Site to a New Host

Here is what you exactly need to do to migrate your existing WordPress site to a new host:

Steps to migrate your WordPress website

  1. Securely backup and download your WordPress files
  2. Export your WordPress database
  3. Choose a new web host
  4. Move your domain name
  5. Create the WordPress database on your new host server
  6. Edit the local wp-config.php file
    1. Change the database name
    2. Change the database username
    3. Change the database user password
  7. Import your downloaded WordPress database to new host
  8. Upload the Downloaded WordPress files to your new host
  9. Define your new domain and replace the old one
  10. Add the final touches

Securely backup and download your WordPress files

Before you move your website to a new host, it's essential to back up all of your files and data. This will ensure that you don't lose anything during the migration process.

Properly backing up every aspect of your website is really important. You don't want to miss any data.

There are many plugins to help back up WordPress for you.

Typically, you need to install a backup and migration plugin and use its built-in settings to manage which files get backed up (and how often) and where your backups are stored.

WPvivid and UpdraftsPlus are two of the best plugins for this purpose. See the list of other WordPress migration plugins here.

If you prefer a more manual approach and want to migrate WordPress site without plugin, you will need a file transfer tool (FTP) to access your website files.

Two popular FTP programs are FileZilla (free) and Transmit. After installing one, say FileZilla, you can use the SFTP credential from your web host account to connect to your website’s server.

FileZilla 2023 02 27 002015
FileZilla Interface

After that, select and download all files under your website’s directory, including the .htaccess file, which is generally hidden.

FileZilla Download Files
Go to the root folder / and download by right clicking

You will need an FTP username and password from your old host for downloading this.

The process could be time-consuming depending on the number of media uploads you have on your website. While the download is underway, you can proceed to the next step and make a copy of your database.

Export your WordPress database

Exporting your database is a simple process that only needs a few steps.

First, log into your old web hosting server’s cPanel account or the page from where the databases are managed and open the phpMyAdmin or database management application.

Then, from the list on the left-hand sidebar, select the database that contains your WordPress installation and click the “Export” tab on the navigation menu.

Google Chrome 2023 02 27 002019

The default settings of a Quick export and the SQL format for the export are enough for what you require. Next, click the Export to start the database export process. Soon, a file will be downloaded to your local computer.

database export process

After completing the database export and FTP downloads of your website files, you can move on to the next stage.

Choose a new web host

Now find a new web host that meets your needs. You'll want to look for a host that offers the right amount of storage, bandwidth, and server resources for your website and one that has a good reputation for uptime and customer support.

Here are some of the best WordPress hosting services that I recommend:

  1. WPX
  2. Rocket
  3. Cloudways

Move your domain name

If you're keeping the same domain name, you must update your DNS settings to point to the new web host. This is usually done through your domain registrar's website.

If you are migrating WordPress site to new domain, you can easily setup DNS records as instructed by your new hosting provider. After that, you can define your new domain and replace the old one in your database using these steps.

Create the WordPress database on your new host server

Before migrating to the new web host, you must create a suitable WordPress installation environment. For that, you need to create a database into which you can import your SQL data.

Begin by logging into your new web host with the user credentials they have given you, and connect to the cPanel software. In this guide, I will be using the MySQL Databases application.

If your web host doesn’t have that application running, you should contact their support team to find out their method of creating new databases.

To create a database, you need to follow these simple steps:

  1. Open MySQL Database and create a new database with a proper name for your website.
  2. Create a new MySQL user along with a secure password.
  3. Add that user account to the new database and grant it all privileges.

Write down the database name, new MySQL username and password somewhere because you will need them soon.

Complete guide: 8 ways to backup MySQL databases with commands & tools

Important note: If your cPanel or hosting dashboard allows you to install WordPress using a step-by-step process or Softaculous, you can do that first and then import the database later.

Edit the local wp-config.php file

Navigate to the folder on your local computer where you downloaded your website files. In there, you will find a file named wp-config.php that controls the access between WordPress and your database. Create a copy of this file and store it in another folder on your computer. This backup is essential for restoring the changes you will make in case anything goes wrong.

Open the original file with your text editor/code editor of choice and make the following changes:

Change the database name

Locate the following line:

define('DB_NAME', 'db_name');

The db_name portion of this line will currently be set to the MySQL database name of your previous web host. You need to change it to the name of the new database you have just created.

Change the database username

Below the above line, you will see another one:

define('DB_USER', 'db_user');

In this line, you must change the db_user section from the username of your previous web host to match the new username you have just created.

Change the database user password

Finally, you need to edit the third line:

define('DB_PASSWORD', 'db_pass');

Once again, you must change the db_pass portion of this line to the new secure password you created for your MySQL user.

Now save the edited wp-config.php file and close it.

Import your downloaded WordPress database to new host

With your new database ready, it’s time to start the import process. First, launch phpMyAdmin from the cPanel software on your new server and choose your new database from the list on the left-hand sidebar. After 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 before. Next, uncheck the Partial Import check box, ensure the format is set to SQL, and click the “Go” button. The database import will now start and take a variable amount of time to complete, depending on the size of your database. Once it has finished, you will receive a message informing you of the same.

Be sure to change the database's site_url and home_url values (changing the website URL) if you are moving to a new domain name. If you are keeping the same domain, there is nothing to do in this part.

Upload the Downloaded WordPress files to your new host

Now that you’ve successfully imported your new database and reconfigured the wp-config.php file, you can start uploading your website’s files.

Use your FTP program to connect to your new web host and navigate to the folder where your website will be held. If it is the primary or only website being installed on this web server, you can upload the files to the public_html folder.

After selecting the remote directory, you can upload your website files, including the updated version of the wp-config.php file. Again, this process can take a little time. Remember not to delete these files from your local computer after the upload finishes; you will need them until you complete the final steps.

Important note: If your cPanel or hosting dashboard allows you to install WordPress using a step-by-step process or using Softaculous, you can do that first and then upload the files later.

Define your new domain and replace the old one

Note: You can skip this step if you are not moving to a new or different domain. If you're keeping the same domain name, you'll need to update your DNS settings to point to the new web host. This is usually done through your domain registrar's website.

When moving their website, people often add links to other posts on their site or insert images directly by pointing to a URL on the server, causing them to break when moved over to a new domain.

If you want to quickly search for any instances of your old domain name and replace them with the new name, you should check out the Search Regex plugin, which makes the job much easier.

Add the final touches

The final step includes two smaller steps, possibly with several days between them.

Before using the website on your new host, you must reconfigure your domain’s DNS settings. They will be set to point to your previous host, and you have to point the correct records to the new server IP address.

This process will depend on where you have your domain registered. Although its details are somewhat variable, your domain registrar should have all the necessary information to make this change. It can take up to 48 hours for DNS changes to propagate fully.

During that period, you should avoid making any changes from your WordPress dashboard as you may be altering the old version of the website. Ideally, you should do this step at a time when you expect lower levels of traffic.

After the 48 hours are over, you should be accessing the new web host when you visit your website.

You can now log in to your old web host to delete the database and files. 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. To be on the safe side, try to retain those files for an extended period. You can use a lifetime cloud storage service for that.

After the migration

Once you have successfully migrated, you need to test your WordPress site thoroughly. Here are some of the key things that you must check and take help of your new hosting provider to fix.

  1. Check if the links are working properly. You can use an SEO tool like Semrush or a broken link checker tool like "Link Whisper" to check if any links are broken.
  2. Check if all the forms are working properly. Generally, we overlook this part but as WordPress forms are the most important part of your online business, you must keep checking these every now and often.
  3. Check if WordPress emails are going through. Many WordPress hosting services don't offer a proper wp_mail setup. So, it is advised to use a WordPress SMTP plugin to set up sending emails for system, transactional and form-submission messages.
  4. You can also ask your friends and colleague for feedback and request them to notify you of bugs and irregularities in your website.

As you can see, the migration process can be pretty simple when broken down into simpler steps. You just need to be careful at each step and give yourself the option to go back to the original version until the eleventh hour (in case of any issues). I hope this guide helps you successfully migrate your WordPress website to a new host. If you need further help, you can hire me for WordPress-related services.