Guide: Running Multiple WordPress blogs with Multiple Domains

This guide is intended to set up a WordPress installation that allows for multiple WordPress blogs to be hosted on a single server, and for the WordPress blogs to be hosted by different domain names (not JUST sub-domains!)

For example (aka shameless plugs):
http://www.biri.me (this site)
http://www.nevyviera.com (a talented web designer)

This guide will allow for BOTH of those domains to point to separate WordPress sites within a WordPress site network.
Running on a single web server install, and single database install!
As well as allow for a network administrator (a super admin) to be able to monitor and administer both sites if necessary.

Forewarning Guide Notes:
This guide is targeted towards a WordPress 4.x.x install running on Apache and using MySQL

However, this guide may very well be adaptable to other forms of WordPress install (version 3.x.x will still be required, but might(?) very well work on other web server installations)

Let’s Begin!

First you’ll need a WordPress Blog installed in the root of your web server’s hosting directory – not a sub-directory.
This is due to the fact that with having multiple domains being used for WordPress, the Domain Mapping plugin will need to do some pretty heavy virtual host modifications.

Instructions for setting one up a fresh WordPress install can be found here: http://codex.wordpress.org/Installing_WordPress

After installing and configuring the basics for your WordPress install, you’ll need to create/switch to a “WordPress Network”.

Step 1: Prepare Your WordPress

Your existing WordPress site will be updated when creating a network. Unless this is a fresh install and you have nothing to lose, please backup your database and files.

  1. Verify that Pretty Permalinks work on your single WP instance.
  2. Also deactivate all active plugins. You can reactivate them again after the network is created.

Step 2: Allow Multisite

To enable the Network Setup menu item, you must first define multisite in the wp-config.php file.

Open up wp-config.php and add this line above where it says /* That's all, stop editing! Happy blogging. */. If it doesn’t say that anywhere, then add the line somewhere above the first line that begins with require or include:

/* Multisite */
define( 'WP_ALLOW_MULTISITE', true );

You will need to refresh your browser to continue.

Step 3: Installing a Network

The previous step enables the Network Setup item in your Tools menu. Use that menu item to go to the Create a Network of WordPress Sites screen.

network-create

Tools Network Screen

Addresses of Sites in your Network

You are given the choice between sub-domains and sub-directories, except when existing settings restrict your choice.

In our case, I don’t believe it really matters if we use Sub-domains or Sub-directories. But this guide will be using sub-directories.

Sub-directories — a path-based network in which on-demand sites use paths

Network Details

These are filled in automatically, but you can make changes.

Server Address
The domain of the URL you are using to access your WordPress installation.
Network Title
The title of your network as a whole.
Admin E-mail Address
Your email address as super admin of the network as a whole.

Double-check the details and press the Install button.

Note: The installer may perform a check for wildcard subdomains when you have not configured them yet, or when you do not need them at all. Ignore the warning if it does not apply to your network. See the Server Requirements section in Before You Create A Network for information about wildcard subdomains.

Step 4: Enabling the Network

tools-network-created

Tools Network Created

To enable your network, follow the instructions on the Create a Network of WordPress Sites screen. The instructions that you see are customized for your installation. They might not be the same as the examples you see here.

Back up your existing wp-config.php and .htaccess files, unless this is a fresh install and you have nothing to lose.

There are two steps:

1. Add the specified lines to your wp-config.php file
The extra lines go just after where you added the line in Step 1: Prepare Your WordPress.
2. Add the specified lines to your .htaccess file
If you do not have a .htaccess file, then create it in the same directory as your wp-config.php file.
If you ALREADY have a .htaccess file, replace any existing WP lines with these new ones.
In some cases you might also have to add Options FollowSymlinks at the start of the file.

After completing these steps, log in again using the link provided. You might have to clear your browser’s cache and cookies in order to log in.

Step 5: Network Admin Settings

network-admin-link

At the left of your WordPress toolbar, My Sites is now the second item. There, all your sites are listed, with handy fly-out menus, as well as a Network Admin menu item. Under Network Admin you can use the Dashboard item to go to the Network Dashboard screen.

Go to the Settings Screen to configure network options, and the Sites Screen to manage your sites.

For more information, see: Network Admin

? Upgraded and can’t find the Network Admin menu?

Step 6: Administration

There are some additional things you might need to know about advanced administration of the network, due to the additional complexity of a Multisite. Even if you’re familiar with WordPress, the location and behavior of Multisite Network Administration can be confusing.

Read Multisite Network Administration for more information.

For help troubleshooting:

Mostly copy and pasted from, but also paraphrased from source: http://codex.wordpress.org/Create_A_Network

What’s The Next Step?

This video does a really great job of explaining the WordPress Domain Mapping plugin, how to install, and some interesting information about it’s features.

The installation of the plugin is actually a bit trickier than a typical plugin install.

  1. First, you’ll need to install the Domain Mapping plugin from here: https://wordpress.org/plugins/multidomain/
  2. Unzip the contents somewhere, we’ll be moving/installing the files manually. So somewhere remote from the WordPress install is a great place to extract the files for now.
  3. Copy the file called sunrise.php from the plugin archive into your wp-content folder.
  4. Next, in your wp-content folder, create a new folder called mu-plugins.Fun Fact: This directory will automatically load any plugin within it, into every WordPress. It’s kind of like a global, automatically enabled WordPress plugin directory. (No programming is necessary for this, it’s just something that WordPress does itself anyways)The Domain Mapping plugin takes advantage of the folder’s nature to perform it’s magic though.
  5. Copy the file called domain_mapping.php from the plugin archive into the newly created mu-plugins folder.
  6. Return to the root of your WordPress/Apache WebServer directory (eg: /var/www/) and open wp-config.php in your text editor of choice.
  7. ABOVE the line of
    /* That's all, stop editing! Happy blogging */
  8. Add the line:
    define('SUNRISE', 'on');
  9. Save the wp-config file, and go to the page: http://whatever-your-website-is.com/wp-admin/network/settings.php
    You’ll now see two new tabs on the side under Settings labeled: “Domain Mapping” and “Domains”
  10. Go to your Settings->Domain Mapping page, and configure the settings to suit your needs.
    (I’m not positive, but I believe the default settings will probably be just fine)

Now for the fun part!

Configuring a WordPress site with it’s own domain!

So for example, let’s say you want to add another site with it’s own domain…

Steps:

  1. First, you’ll need to go to the Sites->Add New and create a new site
  2. Configure it as you normally would for a WordPress site (
    1. give it a sub-directory path (or sub-domain if that’s the install you chose)
    2. Assign a Site Title
    3. Assign an e-mail address for the Admin
  3. We’ll need the site id of the site that was just added.
    To do this:

    1. Navigate to the Sites dashboard listing page
    2. Hover your mouse over the “edit” link and view the browser tool tip that displays the location address.
      You’ll probably see something like: wp-admin/network-site-info.php?id=###
      Where ### is the site id that we’ll need. (eg: 3)
      – OR –
      actually click the “edit” link, and find the same value from your browser’s address bar.
      There are several ways to obtain this site id value, but those two are essentially the easiest.
  4. Now that we have the site id, we can navigate to the Settings->Domains page to create a domain for this site.
  5. On the Settings->Domains page:
    1. Enter the site id obtained from step 3
    2. Enter the Domain address to be used (eg: biri.me — no need for anything like http)
    3. (Optional) Check the Primary option (if you desire)
      This will make the domain entered your “primary” domain, and have other domains be the virtual ones.
  6. Click the Save button and you should be good to go!

Credits

Please note this guide really wouldn’t be possible if it weren’t for the wonderful support of http://codex.wordpress.org and the youtube video referenced.

If you’re someone who does decide to copy and paste this post to your own blog, please provide some credit to myself http://www.biri.me or at the very least the credits I mentioned.

Thanks!