How to change the primary domain in a WordPress multisite installation

This article describes how to change the primary domain in a WordPress multisite installation. You may need to do this, for example, after migrating a WordPress site to a new server.

Changing the primary domain

To change the primary domain in a WordPress multisite installation, you must update several database entries and a setting in the wp-config.php file. The following procedures demonstrate how to do this.

Step 1: Update the database

To change the primary domain for WordPress multisite, you must first update several database locations. To do this, follow these steps:

  1. Log in to cPanel.
    If you do not know how to log in to your cPanel account, please see this article.
  2. On the Tools page, in the Databases section, click phpMyAdmin:

    cPanel - Databases - phpMyAdmin icon

  3. phpMyAdmin opens in a new page. In the left sidebar, click the WordPress database (in the image below the database is named example_wp922). A list of tables in the database appears:

    phpMyAdmin - Sidebar

    Typically, the WordPress database is username_wpXXX or username_a2wpXXX, where username represents your cPanel username, and XXX is a three-digit number.
  4. In the left sidebar, click the wpXX_blogs table:

    phpMyAdmin - Sidebar - Blogs table

    XX is a random two-letter prefix used in the database table names.
  5. In the domain column, for each row, double-click the value, type the new domain name, and then press Enter:

    phpMyAdmin - Blogs table

  6. In the left sidebar, click the wpXX_options table:

    phpMyAdmin - Sidebar - Options table

  7. In the siteurl and home rows, in the option_value column, double-click the value, type the new domain name, and then press Enter:

    phpMyAdmin - Options table

  8. In the left sidebar, click the wpXX_site table:

    phpMyAdmin - Sidebar - Site table

  9. In the domain column, double-click the value, type the new domain name, and then press Enter:

    phpMyAdmin - Site table

  10. In the left sidebar, click the wpXX_sitemeta table:

    phpMyAdmin - Sidebar - Sitemeta table

  11. In the siteurl row, in the meta_value column, double-click the value, type the new domain name, and then press Enter:

    phpMyAdmin - Sitemeta table

  12. If you have added additional sites, then the database contains additional tables named wpXX_2_options, wpXX_3_options, and so on. For each of these tables, change the siteurl and home values as you did in step 7.

    phpMyAdmin - Sidebar - Second site options table

  13. The database is now configured to use the new primary domain, and you are ready to update the wp-config.php file.
Step 2: Update the wp-config.php file

To update the wp-config.php file, follow these steps:

  1. On the server, open the wp-config.php in your preferred text editor.
  2. Locate the line that contains the DOMAIN_CURRENT_SITE setting:
    define( 'DOMAIN_CURRENT_SITE', 'example.com' );
  3. Replace example.com with the new primary domain.
  4. Save your changes to the wp-config.php file. The domain change is now complete.

More Information

For more information about the WordPress multisite feature, please visit https://wordpress.org/documentation/article/create-a-network/.

Article Details

Other Articles in This Category

Show More

Did you find this article helpful? Then you'll love our support. Experience the A2 Hosting difference today and get a pre-secured, pre-optimized website. Check out our web hosting plans today.

We use cookies to personalize the website for you and to analyze the use of our website. You consent to this by clicking on "I consent" or by continuing your use of this website. Further information about cookies can be found in our Privacy Policy.