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.
Backup WordPress files, everything from the WP root directory and upload it to the new server
Backup SQL Database
Update links in SQL and upload to the new server
Update database credentials
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
Update the database credentials in wp-config.php
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
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.
siteurl => https://newurl.com/site1
home => https://newurl.com/site1
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:
Go to the wp_sitemeta table and update the siteurl with a primary (parent) link along with protocol and trailing slash.
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 — — —
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
DOMAIN_CURRENT_SITE => “newurl.com”
PATH_CURRENT_SITE => “/”
Go to your primary domain’s wp-admin page, and update the permalink
You can find and replace the plugin to update the rest of the other URLs on the database.