Thinking about switching hosts but don’t know how to migrate a WordPress site? Moving houses, getting married, and changing jobs are said to be the three most stressful things in life… However, I believe there is another strong contender for the top three. Transferring your WordPress site from one host to another! So, I’ve got some good news and some bad news. First, the bad news… No matter how many times you’ve done it, migrating a website to a new host will always make your heart race and your palms sweat. The good news is that migrating a WordPress site to a new host is essentially a set of steps that you can repeat each time. It’s nearly the same for each website you migrate. This step-by-step guide to seamlessly migrating your WordPress website will make the process less stressful.
3 ways to migrate WordPress site to a new host
There are three main methods for moving a WordPress website from one hosting provider to another.
- Request that your host do it for you.
- Use a WordPress migration plugin.
- Go old school and use SFTP/FTP.
The best option for you will be determined by your current and new hosting providers, as well as the size of the WordPress site you wish to migrate.
Request that your host do it for you
The first option for migrating a WordPress site is by far the most straightforward (and least stressful!) However, whether or not this is an option depends on which hosting provider you are migrating to. Many managed WordPress hosting providers, such as Cloudways and SiteGround, will either provide a free migration or a plugin to install on your site to perform the migration (more on that in a moment). All you have to do is fill out a brief form on their website with your current hosting information and request that they perform the migration.
Use a WordPress migration plugin
As previously stated, if your fully managed host will not perform the migration for you, they will usually provide a plugin that you can install on your site to do so. It is simple to use this migration plugin. These plugins typically function as installation wizards, guiding you through the process of migrating WordPress files and databases from one location to another. They also install WordPress on the new site automatically in preparation for the files and database to be uploaded. There is another plugin option if you are not using a fully managed host. Follow these steps to migrate a WordPress site using All-In-One WP Migration plugin:
Step 1: Access the backend of the WordPress site you wish to migrate.
Step 2: Navigate to plugins in the WordPress dashboard and click Install New.
Step 3: Look for All-In-One WP Migration and install the All-In-One WP Migration plugin and activate the plugin.
Step 4: Repeat steps 1–4 on the new WordPress site (the one to which you want to migrate) so that the plugin is installed on both the new and old sites.
Step 5: Add the Regenerate Thumbnails plugin by Alex Mills (Viper007Bond) to the site you want to migrate to.
Step 6: Update ALL plugins, themes, and core WordPress files on BOTH the new and old sites (Note: the WordPress version must be the same on both sites).
Step 7: Using the “All-in-One WP Migration” plugin, generate an export file.
Step 8: Optionally, create a rule that will “Find” your new site database prefix and “Replace” it with your old site database prefix (only if necessary)
Step 9: Select Export to File and save the file to your computer.
Step 10: Open the “All-in-One Migration’ plugin on the new site and import the file from the previous step.
Step 11: When prompted, apply the uploaded export file to the new site after it has uploaded.
Step 12: Navigate to Settings > Permalinks and save several times.
Step 13: Verify that all of your plugins are active.
Step 14: Go through the media library. If the images are missing, use the Regenerate Thumbnails plugin to reactivate them.
Step 15: Double-check all pages/posts/etc. to ensure that everything is in order. Then, to see how everything looks, refresh your newly migrated WordPress site.
Step 16: On the new site, Install the Better Search Replace plugin by Delicious Brains.
Step 17: Navigate to Tools > Better Search Replace in the WordPress dashboard.
Step 18: Enter your old site URL (for example, oldwebsite.com) in the “Search for” field.
Step 19: Enter your new site’s URL (for example, newwebsite.com) in the “Replace with” field.
Step 20: Perform a dry run. If you’re satisfied with the dry run, activate the plugin.
Step 21: Go through the theme files (primarily style.css, but possibly PHP files) and replace all instances of “oldwebsite.com” with “newwebsite.com.”
Step 22: Visit your new website. Clear your browser cache if the changes haven’t taken effect. Clear your server cache if the changes still haven’t taken effect.
The All-In-One WP Migration plugin has a size limit for the sites it can migrate (128MB). If you have a large site, the following alternative plugins may assist you in migrating your WordPress site from one host to another:
- Migrate Guru
Make sure to read all of the instructions for the plugin you select to ensure that it is appropriate for the type of migration you intend to perform.
Old school WordPress site migration using SFTP/FTP
However, you may need to manually migrate your WordPress site for more complex migrations. This can be done via the File Manager in your hosting provider’s cPanel or via an FTP or SFTP connection. To use an SFTP/FTP client like Filezilla or Cyberduck, you should consult with your hosting provider(s) for the correct configuration of this connection, but you typically need your hosting account’s username and password, the FTP or SFTP address, and the correct port number. Once you have this information, follow these steps:
Step 1: Navigate to the root folder (public html is the usual location) of the site you are migrating to using File Manager in cPanel or the SFTP/FTP connect. If you are unsure where the root folder is, you should contact your hosting provider, as it may be in a different folder for security reasons.
Step 2: If you’re using the File Manager in your cPanel, choose public html and save it to your computer. Select the public html folder and download it to your computer if you’re using an SFTP/FTP client. You can make a zip file of the downloaded folder to make migration easier.
Step 3: To download your WordPress databases enter phpMyAdmin on the hosting account where the site is currently hosted.
Step 4: Export the database. (Note: If you see multiple databases listed in phpMyAdmin, you may need to contact your hosting provider to determine which one to use.)
Step 5: Choose which database to export. Click Export, then Quick as the export type, and SQL as the file type. Click the Go button.
Step 6: Once the database has been downloaded to your computer, you can create a zip file to import the site using phpMyAdmin. Alternatively, you can use phpMyAdmin to compress the database before downloading it.
Step 7: Ensure that nothing is installed on the site to which you are migrating.
Step 8: Navigate to the new hosting provider and create a new blank database. Navigate to MySQL Databases in the cPanel and click on it. Name the new database appropriately and click Create Database.
Step 9: In the MySQL Users section, create a new user. Create a username and password, then click the Create User button. Take note of any usernames and passwords you use when creating the database and user. You’ll need to make changes to the wp-config.php file.
Step 10: Add the new user to the database by going to the Add User to Database page, selecting the new user and the database, and then clicking Add.
Step 11: Next, edit the wp-config.php file in the WordPress files you downloaded. If you created a new database with the name “DB NAME,” username “DB USER,” and/or password “DB PASSWORD,” make sure to update them here and save the file.
Make a copy of the original wp-config.php and save it somewhere else on your computer. This is a precautionary measure in case something happens and you require database information from the current site location.
Step 12: Open phpMyAdmin on the new site. Choose the newly created empty database. Select the new database in the left window, click the Import tab, select the file to import, and click Go to import the SQL database that was exported from the current location.
Select the database zip file you exported and ensure it is ready to import as a SQL file before clicking Start Import.
Step 13: The next step is to upload the WordPress files to the new installation. Log in to the File Manager of the new site installation’s cPanel or connect to SFTP/FTP for the new site location. Transfer the public html folder to its new location.
Step 14: If you’re migrating from a staging site, subdomain, or a different domain name, install a plugin like Better Search Replace on the migrated site to replace all of the old site URLs with the new domain name URLs.
Pointing your domain name to the new website
After migrating your WordPress site to a new host, you must connect the new site to your domain name.
Update the DNS records with the new IP address, or if you prefer to keep the DNS records on your web hosting, update the nameserver on your domain hosting account.
Step 1: Log in to your domain hosting account first. (For this demonstration, I’m using Namecheap.)
Step 2: Decide on a domain name for your new website.
Step 3: Navigate to Manage Domains and Advanced DNS.
Step 4: In the A Record, replace @ with the new IP address provided by the new web hosting provider. TTL should be fully automated.
Step 5: In the CNAME record, enter www as the Host, your new domain name as the Value, and Automatic as the TTL, and save changes.
Follow your domain hosting provider’s instructions to ensure that all DNS records are present and updated to point to your new website location. Allow between 24 and 72 hours for internet propagation.