Change Multisite Primary Domain

Multisite is a powerful tool for hosting many WordPress websites under the same domain. Changing the primary domain of a WordPress multisite requires updates in several locations. You will need access to the database and SFTP for your site before proceeding.
There are also a few items to be aware of when changing these values.

  • Consistently use your Primary domain when updating these values.
    • Do not switch between www and non-www versions.
  • Some locations are noted as requiring HTTP or HTTPS protocol, so review these carefully.

Update Database

Updating a multisite domain begins in the database of the website. Be sure to consistently use the same version of your domain, and not switch the spelling or change between www/non-www.

We recommend using the non-www variation (EX: domain.com) instead of the www version (EX: www.domain.com) to ensure your subsites write their dependent URLs correctly.

NOTE: If your site uses a custom database prefix, this will impact the table names listed below. If this is the case then replace wp_ with your prefix in the following table names, or change your database prefix.

  1. Open phpMyAdmin to view the database. If you’re not sure how to open the database, review our guide here.
  2. On the left, click wp_yourenvironment
  3. Locate the wp_options table in list and click on it to open
  4. Find the option name and double click on the the option value next to it:
    • siteurl
    • This option should use the protocol, either http or https. EX: http://newdomain.com
  5. Hit the ENTER or RETURN key to save the change
  6. Find the option name and double click on the the option value next to it:
    • home
    • This option should use the protocol, either http or https and exactly match the domain used previously. EX: http://newdomain.com
  7. Hit the ENTER or RETURN key to save the change
  1. On the far left, click on the table called wp_site
  2. Double click on the the domain value
  3. Update this to your domain name without http/https protocol. EX: newdomain.com
  4. Hit the ENTER or RETURN key to save the change
  1. On the far left, click on the table name wp_sitemeta
  2. Locate the following meta key and click the meta value next to it
    • siteurl
    • This option should use the protocol (http or https) and exactly match the domain used previously. It should include a trailing slash / at the very end. EX: http://newdomain.com/
  1. On the far left, click on the table name wp_blogs
  2. If you have already added subsites you may see several rows here. Each value in the domain column should have its domain updated to reference your new domain. Do not include protocol (http/https) here.
    • Subdirectory multisite: The domain column should simply list your old domain through any the rows. Update all rows to your new domain.
      • EX: coolsite.wpengine.com would become newdomain.com
    • Subdomain multisite: The domain column will show several subdomains of your old domain. Keep the subdomain and simply append it to your new domain instead.
      • EX 1: coolsite.wpengine.com would become newdomain.com and newsite.coolsite.wpengine.com would become newsite.newdomain.com.
      • EX 2: oldsite.com would become newdomain.com, and newsite.oldsite.com would become newsite.newdomain.com

NOTE: The next database changes are required only if you have already added subsites. If you do not have subsites, skip to the next part of the guide.

  1. Each subsite has a set of database tables with a specific number added to the prefix. There may be several tables, it will vary by how many subsites you’ve already added.
  2. On the far left open each additional wp_#_options table
  3. Update the following option values:
    • siteurl
    • home
    • These should include http/https protocol.

List of Database Locations

If you’re comfortable with the database and simply need a brief list of the locations, they are found here. We’ve also noted where the http or https protocol should be included.

TableOptionProtocol?Notes
wp_optionshomeYes
wp_optionssiteurlYes
wp_sitedomainNo
wp_sitemetasiteurlYesInclude trailing slash
wp_blogsdomainNoUpdate all rows
wp_#_optionssiteurlYesUpdate all # options tables
wp_#_optionshomeYesUpdate all # options tables

Be sure to also update the wp-config.php file as detailed below.


Update wp-config.php

The last step requires modifying the WordPress configuration file on your website.

  1. Connect to your site using SFTP
  2. Download the wp-config.php file, located in your site’s root directory
  3. Update the following line to use your Primary Domain:
    • define( 'DOMAIN_CURRENT_SITE', 'newdomain.com' );
    • Do not include http/https protocol here.
  4. Save and upload the modified file, overwriting the original.

If you see the following lines, delete them. They will overwrite your database defines in some areas and will cause issues:

define( 'WP_HOME', 'http://somedomain.com' );
define( 'WP_SITEURL', 'http://somedomain.com' );

NOTE: This process can also be done with SSH Gateway. Learn more about using SSH on WP Engine.


NEXT STEP: How to add map subsite domains in a multisite

Still need help? Contact support!

We offer support 24 hours a day, 7 days a week, 365 days a year. Log in to your account to get expert one-on-one help.

The best in WordPress hosting.

See why more customers prefer WP Engine over the competition.