How to Migrate WordPress Multisite

Migrating a WordPress Multisite installation can be a tricky business. It's not as straightforward as it is with single site installations, and there are no plugins to help you out. In this tutorial I highlight the steps I use to perform such Multisite migrations successfully.
Table of Contents

Migrating a WordPress Multisite installation can be a tricky business. It’s not as straightforward as it is with single site installations, and there are no plugins to help you out.

BackupBuddy is my preferred plugin for migrating single site installations, unfortunately it is not yet fully able to perform the same backup and restore procedure for a multisite installation. What it can do is export a single site from a multisite installation, which might be useful to some, but its not really what we are talking about today. Another plugin you might want to check out is WP Migrate DB Pro which helps you migrate databases from one multisite to another.

50% OFF
WP Migrate DB Pro
WP Migrate DB Pro
New Customer Offer — Save up to 50% on your first year of WP Migrate DB Pro for individual use.WP Migrate DB Pro allows you to copy your entire WordPress site from one environment to another with...Show More
New Customer Offer — Save up to 50% on your first year of WP Migrate DB Pro for individual use.WP Migrate DB Pro allows you to copy your entire WordPress site from one environment to another with one click in your dashboard. Show Less

In this tutorial, I am assuming that we want to move a site from a local server to the production server. Here are the basic steps you’ll need to follow.

Step 1 – Move Database and Files

The first step is to open your FTP client and upload the files from your computer to the server. Next, on your server set up your database and user, and use phpMyAdmin to import all the database tables.

If you visit your site now it won’t work, we’ve got some more work ahead of us before we’ll be greeted by a fully working multisite installation on our production server.

Step 2 – Modify wp-config.php and .htaccess

Now we need to modify wp-config.php and the .htaccess files to reflect the new location, database name, user and password. This should be quite straightforward. Be careful to replace any instance of the old URL with the new one.

Step 3 – Modify Database Tables

This is the step when most things can go wrong. You need to carefully modify the database to reflect the new location of your site.

We will be doing lots of search and replace actions, and here is the SQL statement I use for these replacements.

Go to table wp_options

In this table, change the fields site_url  and home.

Go to table wp_blogs

Replace the domain  and path  fields with the new values.

Go to table wp_site

Replace the domain  and path  fields with the new values.

Go to table wp_sitemeta

Change the site_url  field

Searching and Replacing within each Subsite

At this point your site should be loading, however we still have potentially many references to the previous URL in each sub site’s tables. We need to change those through a search and replace procedure.

There are several possible solutions:

Another popular search and replace script (which takes into account the serialized nature of data stored in WordPress tables) is the Search and Replace DB script from Interconnectit.

I personally use the Search and Replace plugin and it has always worked fine for me.

Conclusion

That’s it! You should now have a perfect replica of your local multisite installation on your production server.

If you get lost, I’ve found it useful sometimes to set up a new clean MultiSite installation on the same server, and then compare values and files between that new installation and the one I’m trying to migrate. This can help give you a reference that you can use to identify mistakes you might have done in setting up the migrated website.

If you enjoyed this post, make sure to subscribe to WP Mayor’s RSS feed.

Jean Galea
Jean Galea
Jean Galea is an investor, entrepreneur, and blogger. He is the founder of WP Mayor, the plugins WP RSS Aggregator and Spotlight, as well as the Mastermind.fm podcast. His personal blog can be found at jeangalea.com.

Consider sharing this post so others can find it:

Stay in the know on the latest and greatest products and services in WordPress. We'll send you one email every week with new and trending tutorials and reviews.

14 Responses

  1. > and there are no plugins to help you out.

    Actually, there are several backup/migration plugins that support multisite > multisite, multisite > singlesite, singlesite > multisite

  2. Thanks for the tip about wp-config.php I forgot to change value for:

    “define(‘DOMAIN_CURRENT_SITE’, ‘oldsite.com’);”

    …to “newsite” and I was going crazy with the error. I searched all over about how to migrate a multi-site and there quite little documentation. The few that mention about the config file do not talk about it very much.

    So thank you for your 2 cents 😉

    1. yo’re right…same thing here. all correct but the config part. I have migrate my database, and everithing else like a normal wp istalation using the interconectit tool but I did not remember about changing the domain current site.

      Here I found litte more details about how to get this done: http://tutorialspage.com/migrating-multisite-wp-dont-forget-to-edit-wp-config-php/

      Actually in WordPress codex there is a small mention about chenging this…but I think nobody see it..

  3. THANKS ALOT, I’m almost there :-), I hope. It seems I only have one problem left – “My sites” won’t show. It seems that there is a “/” missing in the url when try reaching it. I get something like this : http://mysite.comwp-admin/network/ – se now “/” between com and wp-admin/network. Any HELP outthere.
    THANKS

  4. Worked great. Thanks! A suggestion for making it even more simple: update the .sql file before importing it, in a text editor and replace the old url’s with the new one simple with find/replace. Worked like a charm for me

  5. You are my hero! I was trying to figure this out on my own first and let’s just say it didn’t work. Missed the wp_blogs table and got caught in a redirect loop.

  6. Thanks for this post…very clear and easy to follow. Btw WP Migrate Pro has a nifty search and replace feature which automatically pre-populates the source and destination fields with the appropriate URLs. I’ve used it for moving multisite and it works great!

Leave a Reply

Your email address will not be published.

Haven't found an answer to your question? Ask us about it.
Although we publish new posts every week, we might not be answering your questions. Recommend a topic and we'll do our best to cover it in one of our next posts.
From hosting to plugins and backup services, the Mayor's office has put together a collection of amazing WordPress deals!
WP Mayor_Icon_white

Join the mayor’s club

Stay in the know on the latest and greatest products and services in WordPress