Changing URL of Wordpress Multisite

I've moved plenty of Wordpress sites before, it's fairly easy to do:

  1. Change domain in settings
  2. Change domain in wp-config.php

Then you are done.

With a multisite however it's not so easy and requires some database changes, it took me a while diving through the WP database to figure out what references need changing.

  • wp_site
  • wp_blogs

So wp_site contains the domain of the site itself so "staging.threadtheweb.co.uk" so I changed that to "live.threadtheweb.co.uk"

update wp_site set domain="live.threadtheweb.co.uk;

The second table contains the blog urls which are the sites linked in the multisite so blog1.threadtheweb.co.uk and blog2.threadtheweb.co.uk. This also contains the base domain too of staging.threadtheweb.co.uk

update wp_blogs set domain="live.threadtheweb.co.uk;

 

Once that is done then you just update wp-config.php part below:

 'define('DOMAIN_CURRENT_SITE', 'live.threadtheweb.co.uk');

Right, now I thought that was the end of it, however you have to change a setting in the options table for each blog. In Wordpress multisite there are a few tables that have to be unique to each site, they are named like wp2tablename and wp3tablename. Depending on how many sites you have you may need to change many, luckily I only had a few so I updated it like this...

update wp_2_options 
set option_value = "http://live.threadtheweb.co.uk/blog1" 
where option_name ='siteurl';

Then

update wp_2_options 
set option_value = "http://live.threadtheweb.co.uk/blog1" 
where option_name ='home';

Then

update wp_2_options 
set option_value = "http://live.threadtheweb.co.uk/blog1" 
where option_name ='fileupload_url';

Repeat that for each site you have and you should be sorted.

Hope that has helped a few people out.