In a fast-paced, increasingly competitive digital world, there are ample reasons why one might need to migrate a WordPress site. Typically, it’ll be due to hosting provider issues and objections, such as security, performance, or cost. Other times a site merger might suffice, if the intent is to reap SEO and ranking benefits. In all cases, however, it’s a lengthy process that can often go wrong without proper care. So, let us explore the best way to migrate a WordPress site, step by step.

Migrating a WordPress site: manually versus automatically

First, let us briefly note that there are, largely, two main ways to approach this process; manually and automatically. Each has its setbacks and perks, namely:

  • The manual approach requires technical expertise, while the automatic approach doesn’t.
  • Automatic migrations might produce issues for larger, more content-rich websites.
  • Tackling more complex migration needs might require a manual approach.

Tools to do so automatically include third-party tools and WordPress plugins like:

  • Duplicator
  • WP Migrate DB
  • All-In-One WP Migration

Still, this approach may not satisfy your needs. So here, we’ll primarily focus on the manual approach, noting useful tools along the way. This should ensure a safer process without requiring deep expertise in the field.

Merging WordPress sites

Finally, let us briefly note that site mergers will essentially follow a similar process. It won’t be quite identical, however, so please don’t use this tutorial for this purpose. Since mergers are usually more demanding SEO-wise, we’d suggest consulting professionals such as for your needs.

The best way to migrate a WordPress site, step by step

With those notes in mind, let us now walk through the migration process.

#1 Back up your website

First and foremost, as with all such practices, you’ll need to back up your site. Should anything go wrong, you should have a backup in hand to fall back to.

There are two ways to do so; with third-party tools or manually. For the former, you may use such WordPress backup plugins as:

  • BackupBuddy
  • VaultPress
  • WP Time Capsule
  • UpdraftPlus
  • ManageWP Backups

If you’d rather do so manually, you’ll need a File Transfer Protocol (FTP) tool. For PCs, FileZilla is an excellent option that WordPress endorses.

Using it, you may connect to your site’s server using your SFTP credentials and download your site’s files from its root folder. If you do so, remember to also get the .htaccess file, which is set to be hidden by default. Through its help menu, have your FTP tool display hidden files so that you don’t miss it.

For more information on this step, if you choose the latter route, you may consult WordPress’s article linked above.

#2 Export your WordPress database

Having done so, you will then need to export your WordPress database. This you will need to do manually, but the process is fairly easy:

  1. Log in to your web server’s cPanel
  2. There, open the phpMyAdmin application
  3. Choose the database you want, which includes your WordPress installation
  4. Select it, and click on the Export tab
  5. Select Quick under Export Method, and click Go

This process will export your database in a .sql format. Keep the output file in hand, and you’re ready for the next step.

#3 Create a new SQL database

Next, to migrate a WordPress site, you will need a new SQL database to migrate it to. For this step, we will assume your new host uses cPanel software and the MySQL Databases application. If they do not, you will need to contact their support team and have them guide you through this step.

If they do, the process here is fairly simple too:

  1. In cPanel, navigate to Databases>MySQL Databases
  2. There, create a new database
  3. Create a new MySQL user, add it to the database, and grant it All Privileges

As you do, note down the user’s credentials for later use.

#4 Edit your site’s wp-config.php file

Now, before importing your old database to the new one, you will need to make some more adjustments, specifically to your old site’s wp-config.php file. This too you must do manually, but this too shouldn’t present challenges.

First, locate this file among your site’s files you downloaded earlier, and make a backup of it to be safe. Then, you’ll need to use your text editor of choice to find the following lines within it:

  • define(‘DB_NAME, ‘db_name’);
  • define(‘DB_USER, ‘db_user’);
  • define(‘DB_PASSWORD, ‘db_pass’);

Each of these lines will now be pointing towards your old database’s name, user, and password, respectively. Replace the lowercase variables with the ones you created for your new database, save your changes, and close the file.

#5 Import your database

You’re now ready to migrate a WordPress site proper, by beginning to upload your old files to your new host. First, you must start with the database itself.

For this step, you will need to do the following:

  1. On your new server, log in to cPanel and launch phpMyAdmin
  2. Select your new database, and once it opens, select the Import tab
  3. Navigate to File to Import, click on Choose File, and select the .sql file you exported in step #2

Before you click Go, make sure that the format is set to SQL. If the Partial Import checkbox is ticked by default, un-tick it.

If both are covered, you may now click Go and have the import process begin. Wait for it to finish, and you may move to the next step.

#6 Upload your files to your new host

With your new database in order, you’re now ready to upload your old website’s files to your new one. Here, you will need your FTP tool of choice once more.

  1. Log into your new server via FTP, and navigate to its root folder
  2. Right-click anywhere within it, and select Upload
  3. Select all files you downloaded in step #1, including the updated wp-config.php file from step #4, and upload them

Once this step concludes, do not delete these files’ local copies in case you need to roll back the migration.

#7 Final settings

The final few steps to migrate a WordPress site are all fairly easy too, but equally necessary. In order:

  • Change your site’s URL. First, you must ensure that trying to log in to your new domain doesn’t try to redirect you to the old one. To do so, you will need to change your database’s site_url and home url values into your new ones. WordPress offers an excellent article to help you with this step.
  • Replace links within content. Next, for both on-page and off-page SEO benefits, you will need to replace all the links within your content that point to your old URLs. You may do so manually if you have little content or use such tools as Search Replace DB to do it automatically. If you’re unfamiliar with it, the WordPress plugin library also offers relevant plugins for this step.
  • Change your DNS. Finally, you will need to reconfigure your domain’s DNS settings to point to your new domain. This process will vary somewhat, and your new host should be able to help with this. Still, WPExplorer offers a handy article if you need additional help.

With these final touches, you should now be done, and your new site should be almost ready to go. Give your DNS changes about 48 hours to take full effect, and you’ll have completed the process.

All done!

So that’s it; the best way to migrate a WordPress site safely and relatively quickly. While not the quickest or easiest process, this tutorial should cover everything you need to see it through. Keep your backups in hand and your new host close, and good luck!