Shahriar Kabir

Software Engineer

MCPD

OCJP

MCSE

Shahriar Kabir

Software Engineer

MCPD

OCJP

MCSE

Blog Post

How To Migrate A WordPress Website From One Host To Another

March 5, 2022 WordPress
How To Migrate A WordPress Website From One Host To Another

Migrate A WordPress Website from one host to another! Thinking of changing hosts but not sure how to migrate a WordPress site from one host to another?

Well, I have some good news and some bad news.

The bad news first… migrating a website to a new host will always make your heart race and your palms sweat, no matter how many times you’ve done it.

Good news: Migrating a WordPress site to a new host is essentially a series of steps that you can repeat each and every time.

It’s practically the same for every website you migrate.

This step-by-step guide to seamlessly migrate your WordPress website will make the entire process a little less stressful.

Two Options regarding  for  How To Migrate A WordPress Website To A New Host

1. Move To A New Host Using A WordPress Migration Plugin

As I mentioned above, if your fully managed host will not do the migration for you, they will usually provide a plugin that you can install on your site to perform the migration.

Using this migration plugin is easy.

These plugins typically work as an installation wizard to guide you seamlessly through the process of moving the WordPress files and database from one location to another.

They also automatically install WordPress on the new site in preparation for the files and database to be uploaded.

If you are not using a fully managed host, there is another plugin option.

Enter the All-In-One WP Migration plugin.

All-In-One WP Migration plugin

To migrate a WordPress site using this plugin, follow these steps:

Step 1: Log in to the backend of the WordPress site that you want to migrate.

Step 2: From the WordPress dashboard, navigate to plugins and click on Install New.

Step 3: Search for All-In-One WP Migration and install the All-In-One WP Migration plugin by ServMask.

All-In-One WP Migration plugin by ServMask

Step 4: Activate the plugin.

Step 5: Repeat steps one to four on the new WordPress site (the one you want to migrate to) so you have the plugin installed on both the new and old site.

Step 6: Install the plugin Regenerate Thumbnails by Alex Mills (Viper007Bond) to the site you’re wanting to migrate to.

Step 7: Update ALL plugins, themes & WordPress core files on BOTH the new site and the old site (Note: the WordPress version must be the same on both sites).

Step 8: Create an export file using the “All-in-One WP Migration” plugin

Step 9: Optional: Add a rule to “Find” your new site database prefix and “Replace” with your old site database prefix (only if necessary)

Step 10: Export to File and download the file to your computer.

Step 11: On the new site, open the ‘‘All-in-One Migration’ plugin and import the file from the previous step.

Step 12: Once the file uploads, apply the uploaded export file to the new site when prompted.

Step 13: Go to Setting > Permalinks and save multiple times.

Step 14: Check all your plugins and make sure they’re activated.

Step 15: Check the media library. If the images aren’t there, use the Regenerate Thumbnails plugin to re-activate them if necessary.

Step 16: Check all pages/posts/etc. to make sure everything looks as it should. Then you can refresh your newly migrated WordPress site to see how everything looks.

Step 17: Install the Better Search Replace plugin by Delicious Brains on the new site.

Better Search Replace plugin

Step 18: In the WordPress dashboard, go to Tools > Better Search Replace.

Step 19: Add your old site URL (i.e. oldwebsite.com) to the “Search for” field.

Step 20: Add your new site URL (i.e. newwebsite.com) to the “Replace with” field.

Step 21: Run a dry run. If you’re happy with the dry run, run the plugin for real.

Step 22: Go through theme files (primarily style.css, but maybe PHP files) to make sure all instances of “oldwebsite.com” are replaced with “newwebsite.com.”

Step 23: Check your new site. If the changes haven’t taken effect, clear your browser cache. If the changes still haven’t taken effect, clear your server cache.

The All-In-One WP Migration plugin has a limit on the size of the site that it can migrate (128MB).

If you have a very large site, these alternative plugins may help you migrate your WordPress site from one host to another:

Duplicator

UpdraftPlus

Migrate Guru

Be sure to read all of the instructions for the plugin that you choose, to make sure that it is appropriate for the type of migration you want to do.

2. Old School WordPress Site Migration With SFTP/FTP

For many migrations, using a plugin should work fine.

However, for more complex migrations, you may need to manually migrate your WordPress site.

This can be done using either the File Manager in the cPanel of your hosting provider or by using an FTP or SFTP connection.

To use an SFTP/FTP client such as Filezilla or Cyberduck, you should consult with your hosting provider(s) for the correct configuration of this connection, but you typically need the username and password for your hosting account, the FTP or SFTP address, and the correct port number.

Once you have this information, follow these step for How To Migrate A WordPress Website From One Host To Another:

Step 1: Using File Manager in the cPanel or the SFTP/FTP connect, navigate to the root folder (public_html is the usual location) of the site you are migrating to. If you aren’t sure where the root folder is, you may want to contact your hosting provider, as it may be in a folder by a different name for security reasons.

Step 2: If you’re using the File Manager located in the cPanel, select public_html and download it to your computer.

If you’re using the SFTP/FTP client, select the public_html folder and download it to your computer. To make it easier to migrate, you can create a zip file of the downloaded folder.

Step 3: You now need to download your WordPress databases. Log into phpMyAdmin on the hosting where the site is currently located.

Step 4: Export the database. (Note: You may need to reach out to your hosting provider to find out which database to use if you see more than one listed in phpMyAdmin).

Step 5: Select the database to export. Click Export and then Quick for the type of export, and SQL as the file type. Click Go.

Step 6: If you are going to use phpMyAdmin to import the site, you can create a zip file once the database is downloaded to your computer. Alternatively, you can select compressed in phpMyAdmin to compress the database before it downloads.

Step 7: Make sure there is nothing installed on the site you are migrating to.

Step 8: Go to the new hosting provider and create a new empty database. In the cPanel, navigate to MySQL Databases and click on it, name the new database appropriately and click Create Database.

Step 9: Create a new user in the MySQL Users section. Create a username and password and select Create User. Note that all usernames and passwords you use to create the database and user. You will need to update those in the wp-config.php file.

Step 10: Add the user to the database by going to the Add User to Database, selecting the new user and the database, and clicking Add.

Step 11: You next need to edit the wp-config.php file from the WordPress files that you downloaded. Make sure, if you created a new database name “DB_NAME”, username “DB_USER, and/or password “DB_PASSWORD“, you will want to update them here and save the file.

wp config file

It is wise to first create a copy of the original wp-config.php and store it elsewhere on your computer.

This is a precaution in case something happens and you need the database information from the current site location.

Step 12: Log into the new site’s phpMyAdmin. Select the new empty database you just created. Import the SQL database that was exported from the current location, by selecting the new database in the left window, hit the Import tab, choose the file to import, and click Go.

Choose the database zip file you have exported and make sure it is ready to import as an SQL file and hit Start Import.

Step 13: Next, you will want to upload the WordPress files to the new installation. Log into the File Manager of the cPanel of the new site installation or connect to SFTP/FTP for the new site location. Upload the public_html folder to the new location.

Step 14: If you are migrating from a staging site, subdomain, or different domain name, install a plugin such as Better Search Replace on the migrated site in order to switch all of the old site URLs to the new domain name URLs.

Pointing Your Domain Name To The New Website

Once you have migrated your WordPress site to a new host, you will need to connect the new site to your domain name.

Update the nameservers on your domain hosting account.

Allow 24 to 72 hours for complete internet propagation.

That is all for today from How To Migrate A WordPress Website From One Host To Another.

Write a comment