WordPress Tutorials

The Definitive Guide To Migrating A WordPress Site

Changed hosts and looking to migrate a WordPress site?

Look no further.

In this guide we’ll cover how to do it with a plugin, manually and we even cover a few hosts that do it for you for free, or have their own ways to make WP migration easy.

(Migrating To A Live Site?) Back It Up

If the site you are migrating to is a live site, for example if you have been updating and changing the site on a staged or local development version of your site, it’s best practice to back up your live site before you try import the copy.

If you don’t know how to back up your site, you can for example do some of the steps below using one of the plugins for your live site, or you can simply follow along with the manual migration part of the guide until you have your site files and sql database file downloaded.

You can also read more about backing up your site here, if you need further guidance.

If your website is an important part of your business, and downtime can have serious economic consequences, you should always do at least a manual cPanel and sql backup, on top of a plugin backup using a plugin like Updraft Plus or Backup Buddy, before you attempt any big changes like for example, importing a new version of your site.

You may even want to look into a service like JetPack Backups.

Migrate WordPress Sites Using A Duplicator/Migration Plugin

When migrating a WordPress Site, the two main ways to do it are to use a plugin, or to do it manually. Let’s start off with the easy part, how to do it with a plugin.

On WPKube, we’ve already covered how to move a site with the duplicator plugin, so in this guide we’ll take a look at the other major free migration plugin, All-in-One WP Migration.

(Updraft Plus  is another standout free backup/migration plugin, but the migration/duplication functionality is locked behind an add-on, which is why we didn’t focus this particular guide on that plugin.)

So obviously, the first step is to head over to Add New Plugins, search for: ‘All-in-One WP Migration’, and install the plugin, then activate it.

Note: Install the plugin both on the site that you want to migrate from, and the host you want to migrate to.

This means you need to install WordPress on the new webhost if you haven’t already. You can do this even if you haven’t switched nameservers yet for most hosts. Just log into the whatever dashboard they have, usually cPanel, head over to Softaculous, and install WordPress.

(If you don’t know how to get to the control panel, you can usually just log into your hosting account, select the service that you have, and then click through to the “dashboard” or “control panel”.)

Now that you have the plugin installed on both websites, on the website that you want to export, head over to All-in-One WP Migration in the WP Dashboard, and select export.

After the file is complete, download it.

After you’ve downloaded the file (the filename should be something like domain.com.wordpress), head over to your WordPress installation on your new host.

Login to the admin, head over to All-in-One WP Migration > Import. Then simply import the file.

Be aware that there is a size limit of 512 MB for the free version of the plugin, and that there is an increased risk of errors for really big sites, even if you do get the premium version so you can do unlimited size, so if you have a very large site, you will probably want to migrate your site manually.

If you’re changing hosts, and you import your site using a plugin before you’ve changed nameservers, you may have some broken links after the nameservers change, so alternatively, you can start with the next step first, although you will face some downtime, or you can simple re-import the site after the domain changes goes live if you’re facing any issues.

(If You’re Changing Hosts) Change The Nameservers For Your Domain

If you’re changing your host, you will need to change the nameservers for your DNS provider(the company you pay for your domain name). If your DNS provider is Namecheap, for example, login to the member area. Then go to the domain list.

Now click the manage button next to the appropriate domain name, then scroll down until you see the nameservers section. Now you can change the name servers to the appropriate ones for your new host. When you’re done, click the check mark to save your changes, and you’re done.

(If you don’t know the right nameservers for your new host, you can usually find them in your welcome email after you sign up. If not, you can try Googling: ‘hosting-company name servers’, and if that fails, send a message to customer support and they should reply with them shortly.)

Note: DNS changes can take up to 48 hours, so it’s recommended that you keep the site live on your old host until you’ve confirmed that the domain leads to the new host. If you don’t do this, your website could see extended downtime during this period, as the domain will usually still point to your old host for at least a few hours after the change.

Migrate WordPress Sites Manually

If you have a very big site, or you’re a perfectionist that simply likes doing all things by yourself, so everything is under your control, a manual migration would be the best choice.

Step 1: Download Your Files

First start up by backing up your files. You can do this by using an FTP client like FileZilla and saving the appropriate folder, or you can do it through a cPanel backup. (If you installed WordPress in your root domain, like most people, you should download your public_html folder onto your computer.)

If your FTP connection is exceptionally slow for whatever reason, you can also try simply archiving (zipping) and then downloading the same folder in the cPanel (or other dashboard’s) file manager. Sometimes this can be a lot faster for shared hosts that have very restricted ftp connections.

Step 2: Export The MySQL Database

You can do this easily from phpMyAdmin. Go into your hosting dashboard, and head over to phpMyAdmin.

Once you’re there, select the correct database.

(If you have more than one WordPress site on your host, you can find the appropriate database by looking at the wp-config.php file of the site you’re migrating. Inside it you can easily find the correct database by searching for DB_NAME.)

Once you’ve selected the database, head over to export, and select go. Download the sql file.

Done.

Step 3: Create a New Database for Your New Host And Import The Old Database

Head over to the “MySQL Databases” section of the cPanel of your new host. Here you simply create a new database with the same name as your old one.

Depending on your host, there might be a mandatory prefix to your databases. This means that even if you just write in the same name for your database, the real name ends up being:

mandatory_prefix_old_wp_database_name_99

In this case, you need to change the name of sql file to: mandatory_prefix_old_wp_database_name_99.sql, from it’s old name.

Now you can head over to phpMyAdmin, go to import, and import the sql file.

Then you need to open up the wp-config.php file that you downloaded, search for DB-NAME again, and change the value to the name of the new database.

Now we want to create a new user. Go down to “Add New User”

Again there might be a mandatory prefix, in which case you have to open up your wp-config.php file again, search for DB_USER and change the user. If you also changed the password, you need to change the DB_PASSWORD also.

Now go down to add user to database, select the user you created, and add them to the database.

Step 4: Upload Your Files

Now all you need to do is upload the files you downloaded earlier to the appropriate (usually the root, public_html) folder of your new host.

Now go over to the the temporary URL of your new host, and you should be able to see your old WordPress site up and running on the new host. This means that you’re now ready to change the name servers.

Step 5: Change The Name Servers

Follow the exact same steps as mentioned above under the plugin section.

If you’re not changing hosts, but domains, or creating a dev version of your site, you need to do a few more changes…

(Not Changing Hosts, Just Creating A Local Or Staged Development Version or Changing Domain Only ?) Do A Few Final Changes

First go to phpMyAdmin, head over to wp_options, and change the ‘siteurl’, and ‘home’ fields’ values to the appropriate url.

You can also use a plugin like Better Search and Replace to search for and replace all your old urls with the new appropriate url for your local/staged version of WordPress.

This way you can change the url in all the places that you’ve just written it out, like for example in widgets or posts (images in posts will typically be broken unless you use a search and replace tool).

Hosts That Do WordPress Site Migrations For Free

Are you looking for a new host, but not completely comfortable doing your own migration even with a step-by-step tutorial? There are some hosts that offer free migrations when you sign up for their service. A few good examples are:

These are all reputable hosts in the WordPress sphere and are good choices for people at different stages with their website.

If you are a beginner, and your site doesn’t have a lot of traffic, InMotion is a great option for shared hosting. They offer PHP 7, free https through easy let’s encrypt integration, and stellar customer support.

If your site is blowing up, you’re seeing heavy traffic and you need a little more than shared hosting, you can go with either Flywheel or WPEngine for managed WordPress hosting.

How To Migrate To WP Engine Specifically

WP Engine used to do the migrations for free, but now they actually have their own plugin that allows you to easily migrate sites to their platform.

You can get the plugin here.

Be Careful

When you’re doing big moves like migrating, especially if you’re implementing new functionality or a new design on your site, expect something to break. Be prepared. Like mentioned earlier, back your live site up, and double check that everything is working when your new version is live.

Congrats, you have now successfully migrated a WordPress site.

Let us know in the comments if you successfully migrated your website using these instructions.

Ragnar

Ragnar is a passionate WordPress user and freelance writer for hire. When he's not writing or tinkering with WordPress, he's probably trying to learn a new language, or struggling to improve himself.

View Comments

  • Very clear! I was just doing a website migration and seems like you got it all covered. It's pretty much like working in a mine. :)

  • I'm just a beginner and I created a WordPress website just for practice I want to online my localhost already created WordPress website.. what can I do.. please guide me. I'm tired of everything because I'm not finding relevant content for it everybody is telling first to buy a free domain and hosting then install WordPress on it like 000webhost.com. but I want to online my already designed WordPress site for free..!

Recent Posts

How to Start an Online Course Using WordPress and LearnDash

Trying to figure out how to start an online course so that you can share…

1 month ago

LearnDash Review 2024: The Best WordPress LMS Plugin?

Considering using LearnDash to create online course content with WordPress? LearnDash is a popular WordPress…

2 months ago

WordPress XML Files: What They Are and How to Open Them

WordPress XML files see a lot of use for me as a content creator, and…

2 months ago

6 Best WordPress LMS Plugins – Detailed Comparison & Review for 2024

If you’re looking for a way to deliver an online course, complete with all the…

2 months ago

The Top 8 SEO Tools And WordPress Plugins For Maximum Visibility (2024)

Search Engine Optimization (SEO) is crucial for any website that wants to maximize its traffic…

3 months ago

Kinsta Hosting Review 2024: Is This WordPress Host Worth the Investment?

Kinsta is a notable brand in the WordPress hosting space. The standout aspect of the…

4 months ago