How to Setup WordPress Multisite Domain Mapping

Updated on November 09, 2017

Multisite is a great way to manage all your WordPress sites from a single installation. However, a very common issue that WordPress multisite administrators face is how to setup domain mapping. By default, additional sites setup within your multisite network are created as either subdomains of the root site (e.g.subsite.network.com) or subfolders (e.g. network.com/subsite). Naturally these don’t look very good and so by implementing domain mapping you can point a site to an external domain, such as domain.com. To other visitors, this will then appear as a normal website.

wordpress multisite domain mapping

WordPress Multisite Domain Mapping

When it comes to setting up WordPress multsite domain mapping you do have a few options as we will dive into below. Some of the steps in this tutorial assume you are hosting your WordPress site with Kinsta; however most of the steps are applicable for anyone.

Step 1 – Add the Domain to Your My Kinsta Dashboard

The very first thing you need to do is add your domain within the My Kinsta dashboard. Click into your main multisite website and under the domains section click on “Add domain.” This creates the necessary DNS records on our end. You must ensure that you then point your new domain to Kinsta.

Add domain multisite mapping

add domain multisite mapping

If you aren’t hosting with Kinsta, simply make sure to add the DNS records for your site with your web host.

Step 2 – Create New Multisite Install

The second step is to create your new multisite install. To do this you will want to login as the network admin and click on “Add New” under sites in your dashboard. You will then be prompted to choose a new site address, title, language, and admin email. Do not include www or .com in your site address. This should be something short and will be used internally.

create multisite install

Create Multisite install

After you create the multisite install you can click into edit and it should look something like this below.

multisite edit site

Multisite edit site

Step 3 – Map a Domain To your New Install

Now that you have your new multisite setup, you need to map the external domain to it. As of WordPress 4.5, they no longer require a plugin to map domains. However, this requires a dedicated IP which we currently don’t provide at Kinsta.

So the easiest way to configure this is still by using a free plugin. We recommend WordPress MU Domain Mapping from the team over at Automatic. You can download it from the WordPress repository or by searching for it within your WordPress dashboard under “Add New” plugins. You will then need to “Network Activate” the plugin while you are logged in as the network admin.

network activate wordpress multisite domain mapping

Network activate plugin on Multisite

The plugin installs a file, sunrise.php, which you will need to move from within /wp-content/plugins/wordpress-mu-domain-mapping/ into the root of your /wp-content/ folder.

sunrise multisite mapping file

sunrise.php

Then in your wp-config.php file, you need to define it. So add the following code:

define( 'SUNRISE', 'on' );
sunrise wp-config file

Configure sunrise in wp-config.php file

You then need to grab the site ID. Go to your list of sites and hover over “edit” on the install you just created. You can then see the site ID in your browser’s status bar at the bottom.

multisite ID

Multisite ID

Take your site ID and enter it on the “Domains” page under settings. Ensure that the primary box is checked. This will then map that side ID to the domain.

domain mapping

Domain mapping to ID

And don’t forget to point your new domain to Kinsta.

Alternate Options

There are a few other options for setting up WordPress multisite domain mapping as well.

1. Human Made Mercator Plugin

The Human Made team developed the free Mercator plugin to help make setting up domain mapping for multisite easier. It requires WordPress 3.9 or newer for the new sunrise processes. The setup is fairly similiar to the tutorial we walked you through above. They recommend dropping the Mercator’s directory into your mu-plugins directory. You may need to rename the folder from Mercator-master to mercator.

Then create a wp-content/sunrise.php file with the following:

<?php
// Default mu-plugins directory if you haven't set it
defined( 'WPMU_PLUGIN_DIR' ) or define( 'WPMU_PLUGIN_DIR', WP_CONTENT_DIR . '/mu-plugins' );

require WPMU_PLUGIN_DIR . '/mercator/mercator.php';

Additionally, in order for sunrise.php to be loaded, you must add the following to your wp-config.php:

define('SUNRISE', true);

2. WPMU Dev Domain Mapping Plugin

And last but not least, the team over at WPMU Dev also developed a premium Domain Mapping plugin. So if you already have a membership with them, you definitely want to check that out.

Was this article helpful?
No, or there was something off

Hand-picked related articles

Use WordPress?

Join 20,000+ others who get our FREE weekly newsletter with WordPress tips on how to drive more traffic and revenue to your business!

You have Successfully Subscribed!

Send this to a friend