Get $500+ of the best After Effects files, video templates and music for only $20!
WordPress Multisite Beyond Basics: Essentials and Domain Mapping

WordPress Multisite Beyond Basics: Essentials and Domain Mapping

Tutorial Details
  • Program: WordPress
  • Version: 3.0 or higher, 3.3 recommended
  • Difficulty: Easy-Intermediate
  • Estimated Completion Time: Around 30 mins

Today we will be discussing a few very important aspects of WordPress Multisite. If you are new to WordPress Multisite please go through the WordPress installation tutorial first to get an overall idea of the Multisite feature in WordPress. In this tutorial I shall be discussing a few key things essential for WordPress Multisite installation, along with some common troubleshooting tips. Finally I shall discuss WordPress Multisite Domain Mapping in detail.


Key Things to Know About WordPress Multisite Installation

Installing WordPress Multisite Using Plugin

You can install WordPress Multisite using two methods. One is using the plugin Enable Multi-Site and another is manual installation. It’s recommended to use manual installation since the installation changes will then be transparent and can be easily altered later.

Changing From Sub-Directory to Sub-Domain

In case you want to change your installation type from sub-directory to sub-domain, please use the following steps:

  • You need to delete all the sites which were created under your main site
  • Enable the sub-domain option from the wp-config.php file by modifying the following code:
    define( 'SUBDOMAIN_INSTALL', true );
  • Finally update your Permalinks

Since you will need to delete all your sites it’s recommended to make the decision carefully while choosing between sub-domain and sub-directory during installation.

Keeping a Default Theme for All Your New Sites

If you want to keep a default theme for all your newly created sites then please go to your wp-config.php file and add the following line of code below the specified line:

	// Below this line
	define('WPLANG', '');
	// Add this line
	define('WP_DEFAULT_THEME', 'classic');

Replace ‘classic’ with the folder name of the theme you like.

Add Yourself to All Your Sites

The different sites created will only be visible under My Sites if you have been added as a user for that site. If you are a Network Admin then please add yourself as a regular user for all your created sites so that you can manage them straight from your dashboard.

Let Users Define Custom CSS

Generally the users are not able to edit the themes for their sites but once you (as a Network Administrator) install and activate the Custom User CSS plugin then the site owners can design their themes by defining custom CSS.


Common WordPress Multisite Troubleshooting

Created Sub-Domains Not Working

Your hosting platform should support the Wildcard DNS feature. Please check with your hosting provider prior to installing WordPress Multisite.

To create a Wildcard DNS entry please login to your Control Panel provided by your host and look for the Domain section. Under Domain click on the Subdomain option. This is the place to enable sub-domains for your website.

Once you click on the Subdomain option in the control panel, under Create a Subdomain enter an asterisk ‘*’ in the Subdomain field and then click on Create. The Document Root should point to the root directory of your WordPress installation.

Created Sub-Directories Not Working

The Apache mod_rewrite module should be supported by your hosting provider. This is required in the creation of multiple sites. If you are using WAMP you can enable it by going to Apache > Apache modules > mod_rewrite.

Network Cannot Be Enabled Error

This error occurs if the Site URL is not the same as the WordPress URL, so under WordPress’ Admin Dashboard Settings > General please ensure that they are the same prior to installing Multisite.

Wildcard Sub-Domain Incorrect Error

In order to solve this problem please go to your hosting provider’s control panel where you have defined the wildcard DNS and then update the Document Root of your sub-domain to point to the correct location.

My Uploaded Media Not Working

All the uploaded media including images are located under your created blogs.dir folder. Please check your .htaccess file if the following line of code is in the same format or not. Also ensure that mod_rewrite is enabled for your server.

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

If you find any other issue with WordPress Multisite please feel free to refer to the Official Multisite Support Forum, it contains hundreds of solutions for your common Multisite problems.


Domain Mapping

One of the coolest parts of WordPress Multisite installation is the mapping of domains to turn your network sites into unique domains that carry their own identities. Using Domain Mapping lets you define a custom domain for your blog/site instead of the default address you get when you sign up or create a new site. For example, using a sub-domain install, if you create a new site you will have the URL newsite.parentsite.com. But using Domain Mapping you can turn it into www.newsite.com. Thus Domain Mapping can be used to point external domains to your network sites.

Domain Mapping hides the fact that the site is a part of a Multisite network.

Let’s discuss Domain Mapping in detail.


Step 1 A Little Bit of Your Host cPanel

Before going for the Domain Mapping let’s do a bit of backend work from our cPanel. Please login to your host’s cPanel. Generally the URL of your cPanel will look something like http://www.hostname.com/cpanel or http://www.hostname.com:2082 . Once you log in, you will find two options under the Domains section named Addon Domains and Parked Domains.

Here we will be using the Parked Domains option since we have our WordPress installation in the root directory. The Addon Domain option can be used if you are utilizing WordPress outside the root directory. Under Parked Domains enter the name of the new domain you want to park on your primary domain and then click on Add Domain. The parked domain should automatically point to the root directory of your installation which is generally public_html.

The new domain name should be registered prior to parking.

If you are using the Addon Domains option then you are probably not using your Primary Domain for mapping purposes. After clicking the Addon Domains option fill in all the required details in the window and click on Add Domain.


Step 2 The DNS Settings

After your new domain has been parked, you need to be sure that the DNS Settings are properly configured for your domain. For this you should have your DNS / Name Server information. This can usually be found in the Account Information section of your host’s cPanel. Once you have that info you need to login to your registrar’s website where the domain was registered. Here we have used Go Daddy for registration. Once you login, under My Account > Domain select the required domain name to open the domain editor and then click on Set Nameservers option under the Nameserver section.

Here you can use either of the four options to set up your Name Server.

  • I want to park my domains: This option will park your domain on GoDaddy’s parked servers.
  • I want to forward my domains: This option will forward your domain to another URL.
  • I have a hosting account with these domains: This option is used if the domain is hosted with GoDaddy.
  • I have specific nameservers for my domains: This option is used if your domain is hosted by another company. Here you need to enter the Name Servers provided by your hosting company. We will be using this option for this tutorial.

Once done click on the OK button.

If the nameserver info is changed it may take some time to propagate.

Although I have used GoDaddy and Host Gator in this tutorial, these options are very similar to any other vendor’s interface.


Step 3 WordPress MU Domain Mapping Plugin Installation

Now you need to manually install the WordPress MU Domain Mapping plugin in order to activate your domain mapping. Please download the plugin and extract the files. Copy all files (except the sunrise.php file) to your wp-content > plugins folder. Then copy the sunrise.php file to your wp-content folder.

Open your wp-config.php file and enter the following line of code under the code where you have enabled your multisite feature.

define('WP_DEBUG', false);
define('WP_ALLOW_MULTISITE', true);

define('SUNRISE', 'on'); // Add this line here:

define( 'MULTISITE', true );
define( 'SUBDOMAIN_INSTALL', false );
$base = '/';
define( 'DOMAIN_CURRENT_SITE', 'localhost' );
define( 'PATH_CURRENT_SITE', '/' );
define( 'SITE_ID_CURRENT_SITE', 1 );
define( 'BLOG_ID_CURRENT_SITE', 1 );

/* That's all, stop editing! Happy blogging. */

Save the changes.

After that you will be able to see the Domain Mapping option under the Settings menu of your Network Admin dashboard.


Step 4 Mapping The External Domain to One Of Your Child Sites

Now you are ready to map the external domain to one of your child sites. For this please click on the Settings > Domain Mapping option of your Network Admin Dashboard.

Under Server IP Address put the IP address of your web server. You may contact your host for this address or visit this site to find your site’s IP address.

Finally click on Save.

Next go to the Dashboard of one of your child sites for which you want to map the domain.

Then under Tools > Domain Mapping add the external domain which we have registered. Check the Primary Domain For this Blog checkbox to make it a primary domain for this site. Finally click on Add.

If your domain name includes a hostname like "www", "blog" or some other prefix before the actual domain name you will need to add a CNAME record for that hostname in your DNS pointing at this blog URL. For this please log in to your host cPanel and click on Advanced DNS Zone Editor under the Domains section and set up your CNAME record.

That’s it you have successfully mapped an external domain to your site. To verify please check the URL by visiting your child site.


Step 5 Final Steps

If you don’t want to utilize the original sub-domain URL of your child site any more, you may remove all the traces of the URL from the Network Admin Dashboard. For this go to Sites > All Sites and Edit the Site which you have mapped. In each of the tabs search for the old URL and replace it with the new URL.

In order to redirect users who type the old URL, please log into your cPanel and click on Redirects under the Domain section. Here you need to select the Type, the URL to be redirected and the URL to which it will be redirected. Finally click on Add.

That’s it for now, in my next tutorial I shall be explaining the WordPress Multisite Database in detail using phpMyAdmin and some really cool functions to be used in WordPress Multisite. Thanks a lot for reading.

Add Comment

Discussion 17 Comments

  1. Rick Benetti says:

    I cannot use external domain’s, example: I have host client’s but their one by one have their host account.

    It’s same dns and host IP but different accounts.

    Will great do this.

    • Soumitra says:
      Author

      Hi Rick,

      You can simply map the domains by pointing them to the same IP of your server. Please check with the different hosting providers for the available Addon Domain options.

  2. Evan Payne says:

    Very nice writeup, really looking forward to part two.

  3. Michael says:

    I’d really like a write up on how I can create network wide navigation for multi sites. Preferably without a plugin.

  4. Bharat says:

    Everything is explained related to multi-site in WP here. Hope you will comeup with more posts like this.

  5. This technique is really amazing, but there is problem with sitemap.xml generation: the plugin don’t “see” the mapped domain and generates sitemaps with URL from WordPress multi-installations.

    It been cool if the plugin generates 1 sitemap (or more) for each installation, and “sitemap index” (a sitemap linking other sitemaps) with URL for mapped domains. :)

    Somebody knows how to solve this? There is a plugin working with this? :(

  6. Connor Crosby says:

    Just a heads up, anyone who has 1and1 for hosting, the sub-domain option for multisite does not work. 1and1 does not allow automatic sub-domain making.

  7. Clifford says:

    How do SSL certs go with WP MultiSite?
    1) If using subdomain setup (e.g. site2.example.com) then you’d need a Wildcard domain SSL cert, right?
    2) If using subdirectory setup (e.g. example.com/site2) then you wouldn’t need wildcard domain SSL cert, just a regular single-domain cert, right?
    3) But if you have domain mapping to subdirectory (not subdomain), do you still only need a single SSL cert – or do you need a new SSL cert per mapped domain (e.g. site2.com)?

    • Soumitra says:
      Author

      Hi Clifford,

      Thanks for raising this important topic.

      In case of subdomain setup a Wildcard SSL will do it for you.

      In case of domain mapping you may add all your domains to the main certificate. You need to use the Multiple Domain (UCC) SSL certificate for this.

  8. Carlos says:

    Hi! I completely setup my MS but how can I tell my domains to add the “www” ? If I map the domain example.com I can reach the blog by going to http://www.example.com and also works going to example.com, but I want to the address always add the “www” (because if I write it or not it doesnt show in the address bar). Thanks great post!

    • Soumitra says:
      Author

      Hi Carlos,

      You may try doing a 301 redirect.

      Step 1. Please ensure that your host’s Apache Rewrite Module is turned on.

      Step2. Download your .htaccess file from your website’s root web folder and after creating a backup of the same append the following lines in it.

      RewriteEngine On
      RewriteCond %{HTTP_HOST} ^example.com
      RewriteRule (.*) http://www.example.com/$1 [R=301,L]

      Here replace example.com with your domain name.

      Step3. Finally upload the edited .htaccess file and then try accessing your non www url.

  9. Janmeet says:

    Currently I have installed 4 WordPress Installations with sub-directories but with this WordPress Multisite feature I think i can have all of them at one place. I wanted to know that if I enable WordPressMU on my domain http://itsjhworld.com and create network with my other 3 sub-directories will there be any loss of content , media or any other data?

  10. Dane says:

    I have tried this on my wordpress multisite setup. Once the plugin is installed it shows up under Network Admin dashboard but not under the sites.

    In Network admin->Settings: I see Domain Mapping and Domains.

    I go into domain mapping and set the IP and the options and save. Then When I go to Domains I try to add domains and nothing happens.

    Has anyone seen an issue like this?

    • Dane says:

      Never mind. I figured it out. I didn’t realize the domain mapping doesn’t show up under the main site.

      Thanks

  11. kamal ashraf says:

    it is awesome tutorial, i was having problem with Sub domain, now i can create a multisite network site in sub domain, thanks.

  12. هند says:

    I want to control user registration no user will have a blog without admin approval
    thus I installed Multisite User Registration Manager plugin

    but I had a problem :
    wordpress has its own registration page on :

    http://domain.net/wp-signup.php

    and my plugin on another link….

    I want to prevent users from registering by this link and register using my plugin link

    thanks

Add a Comment

To add a code snippet to your comment, please wrap your code like so: <pre name="code" class="html">YOUR CODE</pre>. You can replace the class name with "js," "css," "sql," or "php." If there are any "<" or ">" within your code, please search and replace them with: &lt; and &gt; respectively.