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



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

  1. Hi brian my apologies for the double post I am I tested in doing this but have questions and would be willing to pay for the answers.

  2. Do you know if it is necessary that all the websites are hosted at the same hosting provider?
    I want to use WP multisite for 5 different websites, but there all hosted on different hosts.

    Thanx.

    1. Hi Diana,

      Yes, Multisite is a single WordPress install, so all of the child sites need to be on that one install on one host. They can’t be on different hosts or even on the same host on different servers.

      Best,
      Brian

  3. Hi Brian,

    I currently have two different domains pointing at two different multisite installations and was thinking of doing exactly this; having them all in the same network to save the hassle of login in and out to make changes to each site. You just saved me a lot of tinkering!

    Do you think it would work on an already existing multisite? By the way, do you have any thoughts or advise on cloning the multisite first either for security/ backup reasons or to make a staging version?

    Cheers!

    1. Hi Carlos,

      I’m sure it’s possible to do this but I’m not sure how to combine two multisite sites. You might have to extract one to separate sites, then import them separately.

      Honestly I don’t think it would be worth the hassle in the end, just to cut two multisites down to one.

      I use the paid verison of Updraft Plus for multisite backups.

      Best,
      Brian

  4. Morning, I’m really interested in doing something like this and really want to use WP… OK The plan is this.

    To set up a main domain : http://www.mysite.com – not mine obviously – being powered by WP as normal. Currently on a shared host, can go to dedicated if needed.

    OK, I want to create a student based portal, so the student would create an account on mysite.com which is fine and get access to the site. But then I want to create subdomains, i.e. nightlife.mysite.com, tickets.mysite.com, etc all running a separate WP install – so different theme etc etc.

    I’ve heard of Multisite is the way to go on this.

    But I also want to allow the student to only have the one log in details – so they’d create an account on the main domain, mysite.com and if they end up wanting to log in via nightlife.mysite.com they can with their details shown etc and be able to move around the site logged in – in theory like Amazon – so one account details gets you access to everything.

    Is this possible with WP, Multisite etc etc?

    Many thanks.

    1. Hi Justin,

      Yes, I think what you want to do is possible with some back-end programming.

      At first, I thought cookies were not shared between main domain and subdomains, but I found out there is a way to share them:
      https://stackoverflow.com/questions/18492576/share-cookie-between-subdomain-and-domain

      So theoretically there would be a way to “say logged in” across domain and subdomain. In the back end, you’d have to give the user access to both sites through programming.

      Best,
      Brian

  5. Hi Brian,
    I read that domain mapping is no longer required after WP 4.5 and that the URL can simply be changed in the individual site settings in the network admin. I’m hoping this is true because I’ve found that the domain mapping plugin won’t work for me as WP isn’t installed in root. Can you confirm/advise?

    Thanks!

  6. Brian
    Great article
    However when I click on all sites.
    I see URL, Last Updated, Registered, Users but NO site ID.
    Am I doing something wrong.

  7. Hi Brian,
      After endless searching, practically leading to neurosuos, I am grateful to have found your simple step by step WordPress MU domain blog!!! Many, many thanks to you.

    1. I seem to be stuck at the Domain MU plugin step. After network activation, & wp-config file editing, I never see Settings -> Domains to enter the site ID in my WordPress Admin panel. The admin user login is setup as Super user. 
    1a. Also, I read I needed to use: https://wordpress.org/plugins/wp-multi-network/installation/
    and follow its instructions.
    Can you please advise/assist?

    2. And just for clarity, within add on domain, zone editor, in the CPanel, I am to configure each separate domain name, including my primary domain name,  to point to public_html/wp? ( where I have installed wordpress mu)

    Thank you again!

    1. Hi Rea,

      1. Are you logged into the master site of the network? You’ll only see Settings -> Domains if you are. You should also see Settings -> Domain Mapping.

      1a. I didn’t have to use that plugin.

      2. Yes.

      Best,
      Brian

    1. Hi Petimi,

      Almost any hosting should support this. Hosting choice might depend more on traffic, etc. This client was using GoDaddy shared hosting and it worked fine.

      Best,
      Brian

  8. Great post! I think a part 2 is needed that address hosting the different domains for the multi-site. Each host may do things differently in how to either park the domains with a wildcard entry or if the Domains are not in your control to set A records (if no Private Name Servers) that point to the root site’s IP. Usually a search for the particular host will have a “how to” explanation/tutorial page. Part 3 could address what a realistic server configuration looks like to handle the demands of a multi-site network. (I came here from reading your Amazon php upgrade article. You had excellent advice.)

  9. Hello Brian,
    I want to do exactly the same thing but due to my lack of experience, I’m really struggling here. I’m uncertain in what you mean by saying “Then, you’ll need to go into your hosting control panel and specify which directory you want the domain names to point to.”
    My directory structure is as follows:

    HOME:
    public_html
    site1.com
    site2.com
    wp-admin
    wp-content
    wp-includes

    Have I started properly?

    1. Hi Dan,

      Not sure if you figured this out already. But no, you don’t create the directories in your WordPress directory. You need to log into your hosting provider, whether it be GoDaddy, Bluehost, or whatever, and set up those URLs to point to your WordPress directory.

      Thanks,
      Brian

  10. Hi Brian,
    A little hand-holding, if you please.
    In the instructions for setting up this siteA.com siteB.com siteC.com and so on, I’m instructed to move a file Sunrise-dot-something into some directory. But I don’t see where I’m to go to find that file initially (the place I’m moving it From. WhereZitAt?
    I’ve poked around in my directory structure, but no joy for me.
    So, I’m ready to be slapped with that trout.
    Thanks loads.
    Ken

        1. For anyone else who had this question (where to find the sunrise.php file) it’s in wp-content/plugins/wordpress-mu-domain-mapping. Seems obvious in hindsight, but it took me a few minutes to find so maybe this will save other people some time.

Leave a Comment or Ask a Question

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