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:
- using plugins to move a single WordPress site
- moving your site from a subdirectory to the root directory
- moving a single WordPress site manually
- moving a WordPress Multisite network
- moving a blog out of a Multisite network
- moving a site into a Multisite network
What You'll Need
To follow this series, you'll need:
- An installation of WordPress with themes and plugins running on it plus some content—posts, pages, media, or whatever happens to be in your site! Your installation might be for a single site or a Multisite Network.
- A second location which you want to move your site to. Again this might be single site or Multisite—it needn't be the same as the starting site in this respect.
- For manual moves, you may need an FTP client, a code editor, and/or access to phpMyAdmin.
Why Move WordPress?
There are a few occasions when you might want to move (or copy) a WordPress site:
- If you've been developing a new site locally and want to upload it to the live server.
- If you're changing hosting providers.
- If you have a live site that you want to make a local copy of so you can work on its development.
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.
Moving WordPress: What Needs to be Moved?
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:
- WordPress itself
- the database
- the contents of the wp-content directory
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.
The wp-content Directory
This directory is unique to your WordPress installation and contains a few folders:
- Your theme(s), in the
- Installed plugins, in the
- All of the media files you've uploaded. These will be in the
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).
- Any folders created by plugins or by WordPress itself, such as the
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.
Subscribe below and we’ll send you a weekly email summary of all new Code tutorials. Never miss out on learning about the next big thing.Update me weekly
Envato Tuts+ tutorials are translated into other languages by our community members—you can be involved too!Translate this post