# Changing the primary domain in a WordPress multisite installation

> Change the primary domain of a WordPress multisite network by updating the database entries and the wp-config.php file.

Source: https://helpcenter.ruachost.com/wordpress/guides/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?

- 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

### Step 1: Update the Database

1. **Log in to cPanel** (or your hosting control panel).
2. In the **Databases** section, click **phpMyAdmin**.
3. Select your WordPress database.
4. Update the following tables:

   - `wpXX_blogs` → Change the domain column to the new domain.
   - `wpXX_options` → Update `siteurl` and `home` values.
   - `wpXX_site` → Update the domain column.
   - `wpXX_sitemeta` → Update the `siteurl` meta_value.
   - For additional subsites (`wpXX_2_options`, `wpXX_3_options`, etc.), update `siteurl` and `home` values.

✅ The database is now configured to use the new primary domain.

### Step 2: Update the `wp-config.php` File

1. On the server, open the **wp-config.php** file in a text editor.
2. Locate the line containing `DOMAIN_CURRENT_SITE`:

   ```
   define( 'DOMAIN_CURRENT_SITE', 'example.com' );
   ```
3. Replace `example.com` with your new primary domain.
4. Save changes to the file.

✅ Your WordPress multisite installation will now use the new domain.

## 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.
