How to change the URL on the WordPress Multisite install
I've moved several WordPress websites to new URLs over the years and thought I knew what to do. Simply update the URLs in wp-config.php and be done! After recently moving a WordPress multisite install to a new domain, I learned multisite installs require a few more changes.
The most confusing part of this was after making changes in wp-config.php, we got a "Database connection error." Naturally we started checking that the database was up, credentials correct, etc. Turns out it isn't a database connection error at all. It's the URL in wp-config.php doesn't match what is stored in the database.
So here’s a rundown of what you need to change for a WordPress multisite install:
- Update wp-config.php by changing this line of the multisite config to the new domain: define('DOMAIN_CURRENT_SITE', 'newdomain.com');
- Update table wp_blogs. Update each domain to the new domain.
- Update table wp_site to the new domain.
- Update each wp_options table. Set the home and siteurl entries to the new domain.
Luckily for us, we did a test run of this change late at night on a weekend when few eyes would be watching.