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 subdirectory.

Native Domain Mapping

WordPress won’t let you enter different domain names directly into the Sites page. You have do a trick, namely, enter subdirectories 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 subdirectories.  So, if your main domain is animals.com, create animals.com/dogs, animals.com/cats, etc.

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 and 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

Please Leave a Question or Comment

Subscribe
Notify of
guest

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

39 Comments
Inline Feedbacks
View all comments
Mpribadi
Mpribadi
2 years ago

Yes it work thanks for sharing.

But then I want to use subdomain from the other domain (different from the default site domain) something like this:

animals.com -> main site
big.dogs.com -> subdomain from different domain

big.dogs.com didn’t work, the hosting only show error page without showing the error status.
where should I start to fix this?

thaxam
3 years ago

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=….

ThomasThomas
3 years ago

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’]);

ThomasThomas
3 years ago

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

monicapruett
3 years ago

Brian,

Thank you for the insight!

I use Genesis on my site and there is a plugin that lets me pull featured posts [most popular, or by category] and display them on my homepage with very little effort from me.

Do you know of a way to pull the featured posts from multiple domains and websites and feature them in one place? On one lading page? I can see how I might use WordPress MU Domain Mapping plugin to manage them, but I was wondering of there was a way to pull content from a dozen sites [or more] and populate single landing pages with the content.

Thank you for your help!

Monica

Arfat Anis
3 years ago

Hi Brian, Thanks for the post. I have a WordPress theme for which multiple installation is allowed only on subdomains. I have this theme installed for several subdomains and I want to access these subdomains using unique domains name for each of them however I want to keep the original subdomain URL masked. Kindly suggest which method should I use avoid infringing upon the only subdomain installation requirement of the theme. Thankyou

Henrik Gren
Henrik Gren
4 years ago

Worked like a charm. The “edit url hack” did all the work. Thank you!

Pedro Pina
Pedro Pina
4 years ago

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.

greguarr
4 years ago

Thanks. It’s work great. You save my day :-)

Pedro Pina
Pedro Pina
4 years ago
Reply to  Brian Shim

Hi Brian I am interested in doing the same thing. Could I pay you to do it for me or show me how to do it???

Diana
4 years ago

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.

Carlos
Carlos
4 years ago

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!

Brian Shim
4 years ago
Reply to  Carlos

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

Justin
Justin
4 years ago

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.

Mudi
4 years ago
Reply to  Justin

Yes this is possible you have to use multisite and some plugins like “Custom Fields” and “AAM” and some customaizations

Juan
Juan
5 years ago

Hi! This blog is so useful.

Is it possible to have woocommerce installed in each site ? will they work separately?

Thank you!

Mara
Mara
5 years ago

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!

Brian Shim
5 years ago
Reply to  Mara

Hi Mara,

Whoa, I didn’t know this! But you are right!
https://codex.wordpress.org/WordPress_Multisite_Domain_Mapping

I’ve never tried using the native technique, but I’ll try it next time I need to do it. Please let me know if it works for you.

Best,
Brian

Mark
Mark
5 years ago

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.

Rea
Rea
5 years ago

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!

Shares
%d bloggers like this: