How to Build a WordPress Multisite Network With Multiple Domains

I remember when I first got the idea to build a WordPress network using multiple domains instead of subdomains. It took me countless hours of Googling, trial and error, code hacking and pounding my fists to figure out something which I can now do in just a few minutes.

Even the WordPress website doesn’t give you very clear instructions on how to set up a WordPress network using multisite, and even then you’re stuck using domains like this for your secondary sites:

www.newsite.example.com

www.example.com/newsite

So thought I’d throw out a lifeline in case you’ve trying to figure this out on your own. At the end of this post, I’ll also show you how you can cut the WordPress brand out of the picture and re-brand WordPress for your company name, your logo and links back to your website or start your very own hosting company using WordPress Multisite.

Let’s start with what you’ll need to set up your WordPress network with multiple domains…

Things You’ll Need to Set Up Your WordPress Network

  1. WordPress installed on the domain you wish to be your primary domain.

(I’m assuming you know how to do this ^ already. If not, I suggest getting a hosting company like Hostgator which literally allows you to set up a WordPress site in 30 seconds by clicking a few buttons and inputting some very basic information)

  1. The WordPress Multi  Domains Plugin from WPMU DEV
  2. The Domain Mapping Plugin from WPMU DEV
  3. FTP access to the hosting account where the WordPress network will be set up.
  4. If you’re doing this in a WordPress site which already has content, please back up your database and deactivate your plugins before continuing to step #1.

Step #1: Prepare WordPress for Multisite

The first thing you’ll need to do is go to the directory where your WordPress site is installed and open up your WordPress config file. It carries the name “wp-config.php” as you’ll see in the screen shot below:

 

Open that file and find the copy-paste this code…

define(‘WP_ALLOW_MULTISITE’, true);

…just above the “That’s all, stop editing! Happy blogging” comment, as seen in this example below:

Once that’s done, save your “wp-config.php” file but keep it open because we’ll be editing it again in a moment. Next you go to the WordPress admin area and locate the option on your WordPress admin bar for network setup. As in the graphic below, you’ll find this option under “Tools.”

Once you click that option, you should see a screen where you put in your network name and the admin email and click “install.” If you see a message that asks you to deactivate your plugins first, make sure you do that as instructed at the start of this tutorial.

Once you’ve click the “install” button, you’ll see a screen which has two blocks of code. This is the first one:

**********

define(‘MULTISITE’, true);

define(‘SUBDOMAIN_INSTALL’, false);

$base = ‘/wp/’;

define(‘DOMAIN_CURRENT_SITE’, ‘vqsuccess.com’);

define(‘PATH_CURRENT_SITE’, ‘/wp/’);

define(‘SITE_ID_CURRENT_SITE’, 1);

define(‘BLOG_ID_CURRENT_SITE’, 1);

**********

This code ^ goes in your “wp-config.php” file just under the “define(‘WP_ALLOW_MULTISITE’, true);” code which you’ve already pasted in. So after copying that in, your “wp-config.php” file should look like this:

Once again, save the “wp-config.php” file but leave it open because we’ve got one more thing to do in there.

The next piece of code in your WordPress admin dashboard should look like this:

{code type=php}

RewriteEngine On

RewriteBase /wp/

RewriteRule ^index.php$ – [L]

# uploaded files

RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

# add a trailing slash to /wp-admin

RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]

RewriteCond %{REQUEST_FILENAME} -d

RewriteRule ^ – [L]

RewriteRule  ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]

RewriteRule  ^[_0-9a-zA-Z-]+/(.*.php)$ $1 [L]

RewriteRule . index.php [L]

{/code }

This code ^ goes into your “htaccess” file which you’ll find under the same directory as your “wp-config.php” file, as in the screenshot below:

The code should replace all other WordPress rules, so after you’ve pasted it into your “htaccess” file, it should look like this:

Once that’s pasted in, save and close the “htaccess” file and log out of your WordPress admin. Then log right back in. When you do, you should be able to open up an option to view your network admin area, as in the screen shot below:

Now you’re ready for the next step…

Step #2: Prepare Your Network for Multiple Domain Handling

Once you’ve got WordPress Multisite setup, your next step is to install the WPMU DEV  Multi Domains Plugin and the WPMU DEV Domain Mapping Plugin . These plugins will allow your users to map secondary installations of WordPress to their own domains. All they’ll need to do is point their DNS towards the IP address where your WordPress network is being hosted.  More on that in a moment.

In order to set up and configure the domain mapping you’ll need to access the plugin options from your network admin dashboard. If you try to access them from the dashboard of the main site or a secondary site, you won’t be able to set it up.

So go to the “Network admin” option in your WordPress dashboard and look under “Settings” for the “domain mapping” option. Once you click that, you’ll come to a screen with some instructions that look like this:

Unfortunately, the instructions on this screen are confusing and inaccurate, and you’ll drive yourself crazy trying to follow them to set up your domain mapping plugin. So let’s lay out exactly what you need to do to finish your installation up.

The first step reads like this:

Please copy the sunrise.php to /home/coach/public_html//wp-content/sunrise.php and uncomment the SUNRISE setting in the /home/coach/public_html/wp-config.php file

The “sunrise.php” isn’t actually under your root folder as it says in these ^ instructions. It’s under the folder for the “domain-mapping” plugin which you’ll find under “wp-content” directory which is in the root directory where your WordPress installation. Move this file into the folder named “wp-content.”

The next step in your WordPress admin dashboard should read like this:

Please uncomment the line //define( ‘SUNRISE’, ‘on’ ); in the /home/coach/public_html/wp-config.php file.

Again, this is a potentially confusing line of code because I’ve yet to see the //define( ‘SUNRISE’, ‘on’ );”  in a “wp-config.php” file. So you’ll need to copy and paste the “define( ‘SUNRISE’, ‘on’ );” without the “//” characters in front of it or the quotations around it. Then, paste this just below the multisite rules which you’ve already pasted into your “wp-config.php” file. Once pasted into your “wp-config.php” file, that code should look like this:

Next, you’ll need to obtain your IP address where your website is hosted from your hosting provider and input that into the place where it requests your IP. DO NOT use YOUR IP for this. It needs to be the IP where your website is hosted, not the IP you log on to the internet with.

The fourth setup option asks if you want non-supporters to be able to set up sites on your network, I’ll leave that up to you.

Finally, you can choose which domain the visitors will be mapped to. I use “domain entered by user” for this option, but again that’s up to you.

Now, your users will be able to set up sites on your network and (provided that their DNS is pointed towards the IP address where your WordPress network is hosted), their sites will map to their own domain.

Bonus Features for Making Your WordPress Network Even Cooler

  1. 1.       Install the WPMU DEV “Ultimate Branding” plugin and change ALL instances of WordPress to YOUR brand name, all WordPress logos and favicons to YOUR brand logo and all links to go back to your main website rather than to WordPress.
  2. 2.       Install WPMU DEV “Pro Sites” to accept payments from your users in exchange for the privilege of setting up their websites on your network.
  3. 3.       Install the WPMU DEV “Multi Database” to have the WordPress sites on your network run off of their own database, thus increasing the performance and scalability of your WP network.

PS: If any of the code in this tutorial does not work, check the single quote character and make sure they’re in plain text format rather than the format which some word processor programs or WYSIWYG editors change them into. The plain text single quote looks more like a small straight line than a curved dash. 

Any questions?

Leave them in the comments section below.

Good luck setting up your WordPress network!

Best,

Seth C

Featured Plugin - WordPress Google Maps Plugin

Simply insert google maps into posts, sidebars and pages - show directions, streetview, provide image overlays and do it all from a simple button and comprehensive widget.
Find out more

Featured Plugin - WordPress Appointments Plugin

Take, set and manage appointments and client bookings without having to leave WordPress. Appointments+ makes it easy.
Find out more

Featured Plugin - WordPress Infinite SEO Plugin

Fully integrated with the SEOMoz API, complete with automatic links, sitemaps and SEO optimization of your WordPress setup - this is the only plugin you need to help you rank your site number 1 on Google - nothing else compares.
Find out more

Featured Plugin - WordPress Ecommerce Shopping Cart Plugin

Out of all the WordPress ecommerce plugins available, MarketPress has got to be the winner - easy to configure, powerful functionality, multiple gateways and more. A simply brilliant plugin!
Find out more

Featured Plugin - WordPress Pop-Up Chat Plugin

No javascript required, no third part chat engine, just fully featured chat right in your own database on your own WP sites - couldn't be easier.
Find out more

Featured Plugin - WordPress Facebook Plugin

Would you like to add Facebook comments, registration, 'Like' buttons and autoposting to your WP site? Well, The Ultimate Facebook plugin has got that all covered!
Find out more

Featured Plugin - WordPress Q&A Site Plugin

It's now incredibly easy to start your own Q&A site using nothing more than WordPress - The Q&A plugin simply and brilliantly transforms any site, or page, into a perfect support or Q&A environment.
Find out more

Featured Plugin - WordPress Membership Site Plugin

If you're thinking about starting a paid, or just private, membership site then this is truly the plugin you've been looking for. Easy to use, massively configurable and ready to go out of the box!
Find out more

Featured Plugin - WordPress Newsletter Plugin

Now there's no need to pay for a third party service to sign up, manage and send beautiful email newsletters to your subscriber base - this plugin has got the lot.
Find out more

Comments (12)

  1. This of course is under the assumption that your WordPress install is the sole site under that one IP address. What if not? What if you share them with other users in the hosting provider?

    • You can run an environment like this on shared hosting (with shared IP). It really all depends on what your plan is. If it will be a pay site, then I recommend getting a dedicated IP.

      Where you will get into trouble is if you want to allow Domain Mapping, and you don’t want to have to manually (or create a script for) parking user’s domains in your hosting control panel, because with shared IP you are forced to use the CNAME avenue versus having users change the A record pointing to your dedicated IP.

      Good Luck!

      • Hi Lou,

        Some good points here. My position though is that if your monthly budget doesn’t make room for getting a dedicated IP, you should be focusing on getting your business profitable and building a solid client base. Fancy things like setting up a network and becoming a hosting provider can come later.

        • Hi Seth,

          Absolutely agreed. If a dedicated IP is not within the budget, then a shared solution will work. With that said, I think planning is key, my advise is to look at all the factors and make a decision based on your needs.

  2. Hi Deuts,

    Actually, that’s not the case. I know you can do this on a shared solution because that’s where I started out doing it. Of course, I don’t suggest this unless your budget absolutely doesn’t allow it, but it can be done.

  3. Seth

    I currently have a proprietary free blog site creation website that i am considering migrating to WordPress multisite and the approach outlined above seems perfect for this. Currently there are over 35,000 blogs on my site – mainly single page blogs including spam blogs that i am going to have to weed out and delete prior to migration.

    That said the site gets a lot of traffic so I am hoping the new site will grow quite quickly. What type of Hostgator account do you use yourself please and what would you recommend for me please – Shared / Reseller / VPS / Dedicated? Can you also tell me if I would be able to get a dedicated IP with ALL of these options or only one or two of them?

    I look forward to hearing back from you shortly.

    Gailstorm

  4. One more question – i understand with a single IP that a single email spammmer on the network could get the whole IP blacklisted. Have you any advice how to avoid that?
    Gailstorm

  5. Drat this was written 1 month after attempting to get a multi-site setup! With that said can I delete the non-working sites (other 5 domains with their sub-domains 2-3 each) from my network and run through this tutorial or do I have to “reset” everything with my host? Currently site and 2 new directory sub-domains I don’t need work fine. The other sites show up on the menu but do not show up when I need to update stuff! I’d really love to get this working right!

    Thanks!

    Sue Darby

  6. Hi Seth, Please, I need some help here,

    I was following your instructions because I thought Multisite network was appropriate for me. In my case I’m using Hostgator’s Baby Plan for a Domain I bought on GoDaddy, This is my main domain and did the WordPress installation trough CPanel’s Quick Install, then I bought a Theme, created some pages and everything was Ok. But I have another domain which was using on a different hosting company and a small CMS company also, now i want to move it all to Hostgator, so I got the back up files from the CMS guys, which consist mainly in HTML files and I want to use WP too (I already did the Addon Domains for this domain). So, following your guide I was able to get to the point where I can see “Network Admin” in WP but when I click it, to move to: Step #2: Prepare Your Network for Multiple Domain Handling… I get this error:
    Fatal error: Call to a member function tables() on a non-object in /home/myname/public_html/wp-admin/network.php on line 31.

    What did I do wrong?

    My domains are not related, but I want to use WP same theme on both.

    I would appreciate Your help, Thanks.

  7. So, at the end when you enable the Domain Mapping, it says you can’t have WP installed in a subdirectory – has to be in the webroot.

    … not sure if you want to update the tutorial to reflect the plugin changes/requirements.

Participate