How to get WordPress multisite subdomains work for your business
A major feature of WordPress that makes it popular among website owners, is its ability to run multiple WordPress sites from a single installation in an account. For webhosts who offer WordPress hosting, we implement this feature for them.
This WordPress multisite feature also helps to manage subdomains easily for a reseller or other business owners who handle multiple ventures. But, if not setup right, these multisite subdomains will not work fine.
By default, the new subdomains setup in the WP multisite system are created as either subdomains (e.g. sudomain.domain.com) or subfolders (e.g. domain.com/subdomain).
To make these subdomains look like individual domains, we configure domain mapping, so that visitors would feel its a unique website. WP multisite feature thus provides the following benefits to business owners:
- They can easily install and manage multiple WordPress blogs from one dashboard.
- Super Admin can access all the blogs and can manage their settings and features easily.
- Site owners need to update WordPress, a plugin or theme only once for all the sites within the network.
Here, we’ll see how to setup domain mapping and get WP multi-site work for your business.
How to enable WordPress multisite subdomains
Before we begin, you need to choose a domain name that will serve as the root domain name for all your customers, say domain.com. Install the latest version of WordPress on the document root of domain.com.
Make sure that mod_rewrite is working on this domain. To enable multi site network, add this entry to wp-config.php:
define( 'WP_ALLOW_MULTISITE', true );
Go to “Tools” –> “Network Setup” in the WordPress admin area. Choose “Sub-domains” option, fill in your site details, and click on “Install”. A list of settings to be put in wp-config.php and .htaccess will be shown in the next screen.
a. Put the displayed wp-config.php settings above the line /* That’s all, stop editing! Happy blogging. */.
b. Put the .htaccess settings displayed on the screen in place of any old WordPress related entries in your .htaccess file.
Now re-login to the WordPress admin area, and you can choose the “Network Admin” mode by going to “My Sites” in the top-left corner.
[ Don’t lose your sleep over server issues. Keep your customers happy with the best support specialists. ]
How to configure domain mapping for WordPress multisite subdomains
As Network Admin, install the plugin WordPress MU Domain Mapping. Once it’s installed, copy the file “sunrise.php” from the new plugin folder and put it under “wp-content”.
Now, put the below entry in wp-config.php above the line /* That’s all, stop editing! Happy blogging. */.
define( 'SUNRISE', 'on' );
Go to Settings –> Domain Mapping, and enable the settings below:
Wildcard subdomains are needed to point your customers’ domains to your multisite WordPress. To enable wildcard subdomains, settings have to be made in Apache web server and BIND DNS server.
In the Apache configuration for domain.com, under the “ServerName” line I added a “ServerAlias” entry as shown below:
<VirtualHost IPaddress:80> ServerName domain.com ServerAlias *.domain.com . . . </VirtualHost>
In the zone file for domain.com, add the wild-card DNS entry as shown below:
*.domain.com. 14400 IN A IPaddress
Once the configuration is updated, restart both services. Your WordPress is now ready to host new domain names in the same installation.