Changing the primary domain in a WordPress multisite installation
When running a WordPress multisite network, you may need to change the primary domain—for example, after migrating to a new server or rebranding your site. On ruachost.com, this requires updating several database entries and the wp-config.php file.
Why Change the Primary Domain?
Section titled “Why Change the Primary Domain?”- Update your site after migration to a new server.
- Rebrand with a new domain name.
- Ensure consistency across all subsites in the network.
Steps to Change the Primary Domain
Section titled “Steps to Change the Primary Domain”Step 1: Update the Database
Section titled “Step 1: Update the Database”-
Log in to cPanel (or your hosting control panel).
-
In the Databases section, click phpMyAdmin.
-
Select your WordPress database.
-
Update the following tables:
wpXX_blogs→ Change the domain column to the new domain.wpXX_options→ Updatesiteurlandhomevalues.wpXX_site→ Update the domain column.wpXX_sitemeta→ Update thesiteurlmeta_value.- For additional subsites (
wpXX_2_options,wpXX_3_options, etc.), updatesiteurlandhomevalues.
✅ The database is now configured to use the new primary domain.
Step 2: Update the wp-config.php File
Section titled “Step 2: Update the wp-config.php File”-
On the server, open the wp-config.php file in a text editor.
-
Locate the line containing
DOMAIN_CURRENT_SITE:define( 'DOMAIN_CURRENT_SITE', 'example.com' ); -
Replace
example.comwith your new primary domain. -
Save changes to the file.
✅ Your WordPress multisite installation will now use the new domain.
Important Notes
Section titled “Important Notes”- Always back up your database and files before making changes.
- Incorrect edits may break your multisite network.
- Test thoroughly to ensure subsites are accessible after the update.