The best way (until now) to change domain name of a WordPress Multisite

Important Note:

If you change the "DOMAIN_CURRENT_SITE" option in your wp-config.php of your multisite, you will not be able to connect to the database (via web and wp-cli)


You should use this tool to change the domain name of your multisite:

Github repository: https://github.com/interconnectit/Search-Replace-DB


1. Clone the git repo into your WordPress root:

$ git clone https://github.com/interconnectit/Search-Replace-DB

2. Open the browser, go to http://old.multisite.com/Search-Replace-DB/ and start searching and replacing:

  • First search and replace your old url to the new one on all the tables (you can click "dry run" to check first, click "live run" to actually make changes):
Old URL: http://old.multisite.com
New URL: http://new.multisite.com
  • Then, search and replace old domain to the new one one on all the main wordpress table (wp_sites, wp_blogs,...):
Old domain: old.multisite.com
New domain: new.multisite.com
  • After making all the changes, you have an option to delete the script to secure your server: just click "delete" button.

Note: if you find your server is really slow to run this utils, you can try the cli script:

$ php /var/www/Search-Replace-DB/srdb.cli.php -h mydbhost -n mydbname -u mydbuser -p mydbpasswd -s old.multisite.com -r new.multisite.com


3. Finally, open the wp-config.php and change the "DOMAIN_CURRENT_SITE" option to the new domain:

define('DOMAIN_CURRENT_SITE', 'new.multisite.com');