Use different domains for WordPress Multisite

To be clear, this post is for my own reference, to make sure I don’t forget how to do it, and is mostly a rewrite of this post.

The Problem

WordPress Multisite is a great part of the WordPress ecosystem, but is designed for networks of blogs either on subdirectories:

  • wordpress.com/bob
  • wordpress.com/trevor
  • wodpress.com/xavier

or subdomains:

  • bob.wordpress.com
  • trevor.wordpress.com
  • xavier.wordpress.com

But sometimes you need to have completely different websites, on different domains using the same admin, such as

  • bob.com
  • trevor.com
  • xavier.com

Out-of-the-box WordPress doesn’t allow this, but it is possible, and actually fairly simple…

The solution

The domains all need to be hosted on the same server and you use a plugin to map the separate domains onto the standard WordPress Multisite subdomain or subdirectory.

Install WP Multisite

First up you need to install WordPress Multisite on your main domain. In Siteground you can select to install as a Mutlisite during the Softaculous installation.  On some hosts you may need to install a single site WP and then convert to Multisite.  There are plenty of tutorials on how to do that on the web.

Siteground installs Multisite in subdirectory mode, and for our purposes that is the simplest way.

You should now have a single site in your multisite that works perfectly well.

Create your domains

In your cPanel you can create a new Addon domain for each additional domain in your network.  This is done as normal, except for the directory; Use the directory of your multisite install as the directory for your addon domains.

Add child sites

In your Multisite Network Admin click on “sites” in the left hand navigation. Click “Add New” and fill out the form.  Note that the subdirectory you use is irrelevant, but it’s probably easier to use the domain name you’re going to use.  E..g. if your main site is wordpress.com and your second site is trevor.com then use wordpress.com/trevor as your subdirectory.

Also note down the Site ID of each site for later use.  The site id can be found when you edit a site – it’s the number in the URL:

/wp-admin/network/site-info.php?id=2

You should now have a Multisite network up and running in standard subdirectory mode.

Add Domain Mapping Plugin

Back in the Network Admin, install the WordPress MU Domain Mapping plugin, and Network Activate it.  I was initially a little concerned by this as, at the time of writing, the plugin hasn’t been updated for about a year.  However I tested it and it works fine with the latest version of WordPress.

Follow the installation instructions on the plugin page.  When you add the sunrise definition to your wp-config.php (step 3) make sure you use the correct type of single quotes, not the ones show on the plugin page:

define( 'SUNRISE', 'on' );

Map your domains

In your Network Admin go to “Settings >> Domains”.

Enter your site ID that you noted down when you created the site, and the domain you want to map to it.  Keep the “Primary” box checked to enable full domain masking.

 

Share This