How to migrate Multisite WordPress Website
If you need to change your WordPress website from localhost to a shared or VPS hosting? Or you brought a different domain, you need to perform several steps to do this. This guide will help you through it step by step. We will be discussing several ways to do so.
Initial Steps
Step 1
Backup WordPress files, everything from the WP root directory and upload it to the new server
Step 2
Backup SQL Database
Step 3
Update links in SQL and upload to the new server
Step 4
Update database credentials
Step 5
Update multisite constants that are defined in wp-config.php
The website will work perfectly
If you didn’t update links while migrating the database, then follow these steps
I am assuming you have uploaded the WP backup to the new server and imported the database also. Follow these steps to make it work
Step 1
Update the database credentials in wp-config.php
Step 2
Go to wp_options table in database(options table of the parent website) and update its siteurl and home for example
siteurl => https://newurl.com
home => https://newurl.com
Step 3
Update every _options table in the database. Each _options table e.g. wp_02_options represents each multisite. So we need to update their siteurl and home manually.
Note, we need to update these keys for every multisite with their appropriate links.
Example
siteurl => https://newurl.com/site1
home => https://newurl.com/site1
Step 4
Update the domain column of the wp_site table with the primary (parent) domain path.
Notice that we didn’t include the trailing slashes. In our case:
Step 5
Go to the wp_sitemeta table and update the siteurl with a primary (parent) link along with protocol and trailing slash.
Step 6
Now go to the wp_blogs table and update the domain for every row exactly the same as we did for the wp_site table. In our case:
— — — The database part is complete — — —
Step 8
Go to the wp-config.php and update the DOMAIN_CURRENT_SITE and PATH_CURRENT_SITE.
DOMAIN_CURRENT_SITE is the primary domain path. Without protocol and trailing slash.
PATH_CURRENT_SITE is the directory path which is in most case “/” a slash
Example:
DOMAIN_CURRENT_SITE => “newurl.com”
PATH_CURRENT_SITE => “/”
Step 9
Go to your primary domain’s wp-admin page, and update the permalink
Step 10
You can find and replace the plugin to update the rest of the other URLs on the database.
Completed