How to Migrate a WordPress Site Without Crying


A major advantage of WordPress over other website solutions is that you can migrate a WordPress site. Unlike solutions such as Squarespace and Wix, WordPress sites can be freely migrated from one hosting environment to another, without your ever being locked into a specific provider.

Unlike other website solutions, WordPress sites can be freely migrated from one hosting environment to another.

The question is how to migrate a WordPress site. It’s always possible, but it isn’t always easy, especially if you’re trying a WordPress site migration for the first time or if you’re working with a large and complex site.

WordPress migrations involve a number of details, and missing even one can lead to some real difficulties down the line. Sometimes, site migrations can even trip up seasoned WordPress pros.

But not to worry–that’s why we’re here! In this article, we’ll discuss the fundamentals of how to migrate a WordPress site so that the process actually works, without stress and confusion. Here’s how to migrate a WordPress site without crying.

Why to Migrate a WordPress Site

Common reasons to migrate a WordPress site are moving the site from staging to production, or changing hosts.

There are at least two reasons why you’d want to move a WordPress site: moving from staging to production, or changing hosts.

One of the most common scenarios involves taking your website from a development (a.k.a. staging) server to production. You might want to do this when you’re ready to launch a new website, or even a redesign of an existing website.

The other scenario involves switching web hosts. You might need to upgrade to a more powerful account type, or maybe you’re not happy with your current provider. In this case, you can move your WordPress site to a new host. (By the way, if you’re looking for an honest and comprehensive review of which WordPress hosting to switch to, check out our guide on who offers the best WordPress hosting this year.)

What Migrating a WordPress Site Requires

You’ll need to migrate both your wp-content folder and your site’s MySQL database.

When it’s time to move your WordPress site to a new host, you’ll need to migrate two distinct things:

  1. The site’s /wp-content/ folder.
  2. A current copy of the site’s database.

These are the two crucial components of your WordPress site, and you have to move them both. The /wp-content/ folder includes your WordPress theme, plugins and uploaded files. You can find it by browsing your files and folders on the server that’s hosting the site.

Meanwhile, the site’s mySQL database contains things like your site’s content, user accounts and site settings. You won’t see the database by browsing your files and folders; you’ll have to look using a program like phpMyAdmin, which most large hosts include in their admin areas (usually cPanel).

4 Common Ways to Move Your WordPress Site

So, how do you access and transfer these items? Below are four popular methods we’ll discuss. They’re in order of difficulty, so we suggest you try the first two options before moving on to the third and fourth.

1. Let Your New Web Host Do It for You

By far the easiest way to migrate your WordPress site is to let someone else do the dirty work. Imagine sitting back in your easy chair while an expert takes care of the entire process.

Sound impossible? WordPress site migration is actually a service provided by many of the better hosts out there—sometimes for free. Be sure to check out the provider’s policy for the rules of the road.

2. Use a Plugin to Migrate Your WordPress Site

The WordPress migration plugin to try first is All-in-One WP Migration.

Next up is WordPress migration through the use of a plugin. This method is often the most user-friendly for grabbing a complete copy of your website for moving elsewhere.

Typically, these plugins allow you to create a downloadable archive of your WordPress website. From there, you can import that archive to your new web host. Just install another copy of the plugin on a fresh installation of WordPress, import your site and the plugin does the rest.

There are a number of WordPress migration plugins to choose from, but two of the best choices are All-in-One WP Migration and Duplicator. Both plugins have free versions in the main WordPress plugin repository, and either plugin will produce outstanding results, while saving you a ton of time.

We’ver written guides to using each plugin. See our guide to using All-in-One WP Migration or our guide to using Duplicator to learn how each plugin works. Of the two, the plugin to try first is All-in-One WP Migration.

Plugins are a great option for those who want to migrate a WordPress site without too much hassle. Just be aware that some highly-customized or very large WordPress installs could cause issues. In those cases, one of the other methods mentioned here may be more appropriate.

3. Through the Command Line

Pretty much anything you can do manually can also be automated via the command line–including WordPress migration.

In fact, our own David Hayes a terrific writeup on how to copy a WordPress site with WP-CLI and rsync. It’s definitely worth checking out if you’re interested in the power of WP-CLI.

How to Migrate a WordPress Site with WP-CLI and rsync

4. Manual Download and Export

If you’re comfortable with the inner workings of a website, you can grab both the /wp-content/ folder and website database by manually downloading/exporting them.

For the /wp-content/ folder, you can use an (S)FTP client to log into your web server and download the folder to your device.

The database is a little more involved. It requires that you log into a tool such as phpMyAdmin, which is often installed with most web hosting packages. Some hosts may also have their own database tool. Either way, you’ll want to export a copy of your site’s database in SQL format.

phpMyAdmin Export Screen

While this method certainly works, it does require an eye for detail. One false move and your WordPress migration can hit a snag. This is the “old-fashioned way,” and here are its main steps:

If you’ve never done a WordPress site migration before, I’d suggest looking at this guide. There are a number like it, but this one’s clear.

I’d only make one amendment from that guide: You should be able to get away with just moving the wp-content folder from site to site. That has all your themes, plugins, and media files—and moving only that folder means you don’t have to worry about overwriting wp-config or .htaccess, both of which can cause you problems.

We’ll walk through these and other common migration problems in “Gotchas” below.

Common Problems with Manual WordPress Site Migrations:

WordPress migrations often fail in similar ways. As a supplement to the guide we linked to above, here are a list of common migration errors and what they mean.

Errors related to improper wp-config and/or .htaccess settings

If you copy the entire WordPress install, you’ll overwrite the critical wp-config and .htaccess files that sit at the root of every WordPress installation. This will mean the following sorts of errors:

If you get “Error establishing a database connection.” instead of your site, it likely means something’s messed up in wp-config. It’s quite likely that you copied wp-config from your test site, and that WordPress is trying to talk to your new database with credentials from your old database. The new database, of course, won’t accept these credentials, so you get an error instead of seeing your site.

If the new layout loads but you still see your old posts, even after importing the database, you might have done the following:

  1. Imported the database without erasing the old database contents, allowing both sets of database tables to live side-by-side in the database, then
  2. Overwritten wp-config or otherwise failed to update the database prefix that it looks for.

Basically, you can put multiple WordPress sites in one database, and WordPress tells them apart with a prefix: wp_ by default, but settable to whatever you like. If you’ve got two sets of tables in your database, they’ve got different database prefixes, and you need to set wp-config accordingly. For example, if the live site database prefix is lvst_, your wp-config will need to look as follows to properly display your database contents:

WordPress table prefix

If the homepage loads fine but you can’t properly navigate to any other pages, it likely means something’s messed up in .htaccess. For example, if you’re moving away from a test site at and you overwrote the live site’s .htaccess in the process, it could look like this:

WordPress htaccess error

Those “/testsite” strings are going to screw everything up: they direct all traffic, except homepage visits, to the /testsite subfolder—which, on your live site, doesn’t exist. Delete /testsite both places it appears, leaving everything else intact including any remaining slashes and surrounding text, and you should be okay. (Note that the opposite problem is possible if you’re migrating to a subfolder from a site that isn’t in one.)

Errors related to database permalink replacement

This is one of the trickiest pieces of manual site migration. It leads to the following sorts of errors:

If a lot of your links, images, etc. point back to the old test site, it’s a sign you didn’t rewrite permalinks at all. They never got changed, so they still have the old url information in them.

If a lot of links, images, etc. are broken after a permalink rewrite, or if a permalink rewrite causes your site to behave in really strange ways, you may have chosen a rewrite rule that garbled everything in your database—like replacing with The missing slash will bork most of your permalinks and lead to unpredictable and ugly behavior on your site. Erase your database, reimport, and try again. (Yes, it’s that bad.)

Your rewrite rules should be as simple as possible while still being complete. In general, you should rewrite to Don’t include http:// or www, don’t include trailing slashes, etc.: you’re not sure if these are present every time there’s a hardcoded permalink, and you want to replace them all. Conversely, don’t replace with if everything actually lived in, or the new permalinks will just point everything to the nonexistent

Steps to Work with Your New Web Host

With files and database in hand, it’s time to move your WordPress site to your new host. Let’s take a look at some of the steps involved:

1. Upload Files and Import Database

Depending on which of the methods outlined above you’re using, there may still be a need to get your site’s files and database transferred over to your new host.

For instance, if you’re using a manual process to migrate your WordPress site, you’ll likely upload files via (S)FTP, overwriting the /wp-content/ folder in a fresh installation of WordPress. In addition, you’ll have to import your site’s database via phpMyAdmin or similar tool.

Also note is that some web hosts have their own migration plugins. They’re fine-tuned to the hosting environment and can make this process fairly seamless. Companies such as SiteGround and WP Engine have these options.

» Keep Reading: How to Transfer Your Site to SiteGround

Therefore, it’s a good idea to check if your new host offers an automated method for site migration before you dive into any manual labor.

Web Hosting Control Panel

2. Test Your WordPress Install

Once your website has been installed on the new host, it’s time to test it out using a temporary URL. Your host should provide this for you when you sign up. Note that you may have to dig into your database to change the site URL or set your migration plugin to use the temporary address.

Be sure to click through the front end of your website and verify that everything looks and functions as expected. Then, do the same thing in the back end.

If you find any issues, you will want to look at your browser console for errors. In addition, turning on WordPress debugging can also be a huge help in figuring out what went wrong. We’ll also provide some helpful troubleshooting tips below.

3. Change Your Domain’s DNS

Now it’s time to point your site’s domain over to your new host.

Everything looking good? Great! Now it’s time to point your site’s domain over to your new host.

If you haven’t already done so, make sure that you’ve added your domain name to the new hosting account. Usually this is done through a hosting control panel.

Your host will then provide you with all the DNS info you need to make the switch. From there, the change is a matter of logging into your domain registrar account and plugging in the new info.

DNS is serious business, however. It’s important to make sure you’re inputting the right information into the right place. Otherwise, your website could become inaccessible. Take the time to read documentation or contact your host’s technical support if you have any questions on the process.

Also, DNS propagation times (the amount of time it takes a DNS change to make its way around the internet) can vary. It could be a few hours or more before the change takes effect. Once that occurs, you’ll be able to access your website on the new host.

Common Issues in WordPress Site Migrations

As we mentioned earlier, WordPress migrations can be tricky, and it’s not uncommon to hit a snag or two during the process. With that, here are a few common migration issues that tend to crop up across different websites, hosts, and migration techniques. If your WordPress migration does run into trouble, these issues are a great place to start for a diagnosis.

URL Settings

Both the WordPress Address and Site Address, available in Settings > General, are vitally important for ensuring that your website points to the right place. If you’re having trouble using the aforementioned temporary URL to test your site, look here first.

If you can’t get into the back end of your site, you can find these options in the wp_options table of your database – just be careful!


In the same category, your site’s Permalinks also have to be in order when you move a WordPress site to a new host.

If, on your new install, you can’t access any pages beyond the home page, it’s likely a Permalink issue. For example, clicking on links to secondary pages will usually result in a server error.

Resaving your Permalink structure, keeping the exact same settings you had on the old host, can usually fix the problem. Head over to Settings > Permalinks to give it a try.

Database Table Prefixes

When installing a copy of WordPress, it’s possible to change the database table prefix via the wp-config.php file. This is perfectly fine to do – just make sure that you’re using the same database prefix on both your OLD and NEW hosts. A mismatch will lead to a broken site.

Caching Plugins

Sometimes, caching plugins don’t play nicely with WordPress migration. If all else fails, it may be worth deactivating any such plugins and seeing if it clears up any hard-to-pinpoint issues.

WordPress Migration Made Easier

Sure, the thought of moving your WordPress site to a new host may have once sent shivers down your spine. But, hopefully this guide has made those nervous feelings a thing of the past.

The key takeaway is that there are a number of different methods to migrate a WordPress site. Some (manual download/export, command line) cater specifically to developers. But others (plugins, host-handled migrations) are fairly straightforward affairs that anyone can use.

But even if you do get stuck, all is not lost. You can still refer to this guide or even your host’s technical support. There are plenty of resources available to help you move your WordPress site to its new home.

Keep reading the article at WPShout. The article was originally written by Eric Karkovack on 2020-06-23 14:43:44.

The article was hand-picked and curated for you by the Editorial Team of WP Archives.

Disclosure: Some of the links in this post are "affiliate links." This means if you click on the link and purchase the product, We may receive an affiliate commission.

Leave a Comment

Your email address will not be published. Required fields are marked *

Show Your ❤️ Love! Like Us
Scroll to Top