July 7, 2021 . 3 MIN READ
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.
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.
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.
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.
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.
In this table, change the fields site_url and home.
Replace the domain and path fields with the new values.
Replace the domain and path fields with the new values.
Change the site_url field
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.
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.
https://premium.wpmudev.org/blog/move-multisite-new-domain/