When I attend WordPress meetups, WordCamps or any other tech event involving WordPress users, there's one question that I get asked more than any other: How do I move my WordPress site?
For new users, the thought of moving a WordPress site from one place to another can be scary. There's all that business of databases, themes, plugins and uploads to think about, not to mention WordPress itself. If you're used to working with static sites and just moving some HTML files and other assets around, this can all seem very new.
But the good news is that moving a WordPress installation can be simpler than you think. Moving a single site WordPress installation can be done with the help of one of a range of plugins. If you need to make a more complex move, such as moving your site manually or moving sites into or out of Multisite, things do get more complicated, but I'll give you a step by step guide to help you do it.
In this series I'll show you how to move a WordPress site, focusing on six different scenarios:
To follow this series, you'll need:
There are a few occasions when you might want to move (or copy) a WordPress site:
Many hosting providers will move your old site to their servers for you, but if yours don't, or if you're moving from a local installation, you'll need to know how to do it yourself. The steps you need to go through are the same in all of these scenarios.
If you've moved a static site before, you'll know that the process is generally quite simple—you just move the files that make up the site. If you're changing domain names and you have absolute links in your code, you'll need to change those throughout your site, but other than that you don't need to do much else.
Moving WordPress is a bit different. To move a WordPress site, you'll need to move three things:
Let's take a quick look at each.
Depending on the method you use for moving your site, you'll either move or copy this, or you'll just create a new WordPress installation in the new location. I'll describe this in more detail when we start looking at moving your site manually.
Moving the database isn't just a case of copying a file and uploading it to the new location. If you're moving your site manually, you'll need to download the database as an
sql file and then upload it to your new site.
If you're moving a single site into or out of a Multisite network, this becomes more complicated, as you don't need to move all of the database tables. However there are plugins which can make this much easier.
This directory is unique to your WordPress installation and contains a few folders:
uploadsfolder for s single site installation, or in the sites folder for a Multisite installation (or the
blogs.dirfolder if the network was created prior to version 3.5).
If you're using plugins and themes you downloaded from the theme or plugin repositories (or from a theme or plugin vendor), it can be simpler just to reinstall these. However, you'll need to make sure you move all of your uploads in the
uploads directory, as they're unique to your site.
The screenshot below shows the
wp-content directory in my site, which as you can see includes five folders and an
index.php file. The
index.php file will be recreated if you reinstall WordPress in the new location:
If this all sounds like a lot of work, don't despair. If your site is a straightforward single site installation, you should be able to use a plugin to bypass all of the hard work. Even if you're working with Multisite, there are some plugins which can help.
However on some occasions you may need to move your WordPress site manually, and in this series I'll show you how to do that too.
There are a few things you may also need to bear in mind when you're moving WordPress:
If you're changing domain names and making a manual move, you'll need to edit any reference to the domain name in your database. I'll demonstrate how to do this in the relevant parts of this series. Your theme shouldn't contain any references to your domain name—it should use a function such as
get_bloginfo('url') instead—but if there are some rogue URLs in your theme files, you'll need to change those as well. I'll show you how to change them correctly, so that the URL is generated by WordPress and not hard-coded.
If you're moving into and out of existing WordPress installations, make sure they're both running the same version of WordPress. This will be particularly important if you're moving a single site into or out of a Multisite Network. By far the best thing to do is make sure both sites are running the latest version of WordPress, but if the old site can't for some reason and the new site is (which it really, really should be), you may have to fix any conflicts that arise after the move.
If you're moving between hosting providers, check that the environment your new site will be in is as similar as possible to the old one (or better, if that's why you're moving). The new server should be running the same (or later) version of PHP, and if you're working with Multisite and using subdomains, make sure those are set up in the same way on the new server. Again I'll cover this in more detail in the relevant parts of this series.
As we work through the parts of this series, I'll deal with the relevant considerations for each part so that you know what you need to do.
Moving WordPress certainly isn't as simple as moving a static website, and what you need to do will depend on the type of WordPress site you're moving. But there are plugins that can make things much easier, and for a manual move there is a process you can follow to move everything you need to. In this series I'll show you how.