Create a WordPress Multisite Network with Different Domain Names

I had a situation where I needed to create a WordPress Multisite network of sites with each site having completely unique domain names.  I found everything I needed by Googling around and I got it to work, but I wanted to document it for later use because there are some “gotchas”.  Here’s the procedure.

Note, my original article used the WordPress MU Domain Mapping plugin. Since then,  reader Mara has pointed out to me that WordPress has made domain mapping a native feature since version 4.5, so that is now my recommended method which I describe below.

The Mission

WordPress Multisite is great for creating a network of sites administered through a single master admin and sharing a set of themes and plugins.  The sites can have different themes or share themes.  You have two choices on how the sites are mapped: by sub-domain or by sub-directory.

Sub-directory would mean your network of sites look something like this:

  • animals.com
  • animals.com/dogs/
  • animals.com/cats/

And so forth.  Sub-domain means your sites would look something like this:

  • animals.com
  • dogs.animals.com
  • cats.animals.com

Note in the above two sets of examples, the second level domain name is always the same: “animals”.

My goal was to have a network of sites that looked like this, with each site having a totally unique second-level domain name:

  • animals.com
  • dogs.com
  • cats.com

All of these would be on the same single WordPress Multisite install.  Can it be done?  Yes!

Your Domains

Of course, I am assuming that you have ownership of the domain names here (i.e., you have purchased them).  You should go ahead and point them all at the directory where you have installed WordPress Multisite.

The process for doing this is different for every hosting provider. On GoDaddy, go to My Products -> Domains and click on Manage.  Click on the domain you want to use to get to the Domain Details page. Open the DNS Zone File tab and change the @ record to point to your server’s IP address (you can get that from the hosting section of the GoDaddy back-end).  Your domain name is now pointed at your server.

Next, go to Hosting -> Manage to get to the cPanel.  Click on “Addon Domains” (this might be named slightly differently on different versions of cPanel, even within GoDaddy).

Go Daddy cPanel

In the “Create an Addon Domain” form, type in your domain name, let the subdomain auto-populate, and choose your Multisite parent’s directory (do not create a new directory for this domain!)  Basically you need to point all of your domain names at the directory with the WordPress Multisite install.

Here’s how to do it if you are self-hosting on Amazon EC2.

Installing WordPress Multisite

I had heard that you can set up WordPress Multisite by “adding one line to wp-config.php”.  Well, it’s not that simple, but it’s not too bad either.

First, install regular WordPress in the root of your master directory (to which your master domain name points). Note that the Domain Mapping plugin below might not work if you install WordPress in a subdirectory, so install it in the root.

To convert this site to Multisite, you indeed start by adding a single define statement to the wp-config.php file, but that is just the beginning.  I used these instructions from WPMU to set up my Multisite install (scroll down to the section titled “Activating Multisite on a Fresh WordPress Installation”).

Note, I highly recommend configuring Multisite from a virgin WordPress install, not an existing site.  When I tried to do it from an existing site, I got the dreaded “Database not found” error (the actual error has nothing to do with finding the database though).

Somewhere around the middle of the process, you’ll have to choose between using subdirectories or subdomains for your Multisite network.  I didn’t know which to pick at first. For our purposes, choose subdomains.

Native Domain Mapping

WordPress won’t let you enter different domain names directly into the Sites page. You have do a trick, namely, enter subdomains first, then edit them to enter the sites.

So, create your sites by going into My Sites -> Network Admin -> Sites.  On that page, click “Add New” to add the sites using dummy subdomains.  So, if your main domain is animals.com, create 1.animals.com, 2.animals.com, and so on.

Once those are created, edit each one and enter the correct domain names. That is a little hack that is needed.

You can worry about setting the themes and other stuff later.  Just get them created for now.

Now, go ahead and try to view the sites in a browser.  Note, it may take a few minutes for the changes to appear.  That’s it!

A Caveat About Hostgator Hosting

I tried this with a client who was on Hostgator hosting and it worked until we tried to log into a child site ad got the error, “ERROR: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress.” I Googled around and found this article, which says:

On hostgator your WPMU must be installed at ROOT or your dedicated ip will not point to it correctly because of the functionality in apache (according to sysadmin)

We’re going to change his hosting and see if it fixes the problem. I haven’t had this issue on GoDaddy.

Domain Mapping Using a Plugin (NO LONGER RECOMMENDED)

For posterity, I’m including the original method which utilizes the plugin.  I don’t recommend this method anymore though.

To do domain mapping using a plugin, start by installing the WordPress MU Domain Mapping plugin from the repository.  Follow the installation instructions carefully.  This installation process for this plugin is more involved than most other WordPress plugins.  You’ll need FTP access to your server in order to modify your wp-config.php file and move the sunrise.php file to /wp-content.

Note, when copying the “sunrise” line of code into your wp-config.php file, make sure you use the correct kind of single quotes. If you just copy and paste the line from the plugin’s website,  you’ll have the wrong kind of single quotes. If you’re unsure, use an editor to overwrite the single quotes with the right ones (‘) from your keyboard.

After you’ve followed the installation instructions, you can start creating subdomains. You’ll need to first create the child multisite installs.  When you do, note the ID number of each install.

Then, go to Settings -> Domains and enter the site ID and desired domain name (without the “http://”)  of each child site:

Domain Mapping screenshot

After I did this, I navigated to one of my unique domain names and it redirected to one of the WordPress Multisite pages!  That was good, but not exactly what I wanted.  I wanted the unique domain name to mask the WP Multisite subdirectory.

After some research, I found the setting that accomplished that.  In the WordPress admin, go to Settings -> Domains and check the “primary” box.  That will make your domain name mask the WP Multisite subdirectory.  That should do it!

Conclusion

So, this is pretty cool.  You can have a network of sites all managed from a single WP Multisite install, and each with a unique domain name.  I am by no means an expert on WP multisite, so let me know if you have any comments or better ways to do things! Hope this was helpful. – Brian



38 thoughts on “Create a WordPress Multisite Network with Different Domain Names

  1. I tried your approach. All I get is that the network does not allow new registrations. To allow… go to settings…

    With a redirect to wp-signup.php?new=….

  2. Sorry, after looking around a bit more I found this on the WP website, which answered my question:

    Edit wp-config.php
    If you get an error about cookies being blocked when you try to log in to your network subsite (or log in fails with no error message), open your wp-config.php file and add this line after the other code you added to create the network:

    define(‘COOKIE_DOMAIN’, $_SERVER[‘HTTP_HOST’]);

  3. Hi Brian,

    Thank you very much for this article. I use WP 5.0.3 and everything seemed to work great.

    But when I try to manage the additional site (domain) I always get error that there are no cookies allowed by my browser, which of course is not true. I tried different browsers (Safari, Chrome, Opera), but had no chance. There is no such problem with any subdomain within the 1st domain. Do you have an idea what to do?

    Thank you very mich from Germany
    Thomas

Leave a Reply to thaxam Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.