On some enterprises, you may need to map a large volume of domains to the WordPress network, for example if you have 10-100, or more, domains. Adding each domain to the server with a ServerAlias directive is not only time consuming but, as the list grows, the server slows while reading all the domains.
The time necessary to add these domains can be shortened considerably by using a wildcard host. To use a wildcard host, you need to access your Web site via a terminal or via SSH with the root user. This is only available on VPS or dedicated hosts. The ideal situation for using a wildcard host is when the main installation of WordPress is the default domain on the server. A quick way to check if your WordPress main installation domain is the default domain on your Web server is to type your IP address in your browser address bar. If your main WordPress site displays in your browser, then you know that you can proceed with using a wildcard host. If it does not, you will need to obtain a dedicated IP address from your Web hosting provider — contact them to set that up for you.
Adding a wildcard host to your Web server requires that you access the Apache configuration files on your Web server. This section assumes that you have access to those files; if you do not, contact your Web hosting provider to either provide you with the access you need, or ask them to complete the steps for you to add the wildcard host to your account.
Here's how you set this feature up:
cd /etc/httpd/
vi httpd.conf
Page down in the file until you see the vhost section. Find the vhost section that contains the information about your WordPress installation and the main domain of your network (depending on the number of domains hosted on your server, there may be several vhost entries in the httpd.conf file — be sure that you're editing the vhost that contains the main domain of your WordPress install.)
<VirtualHost *:80>
/etc/init.d/apache restart
You can now map domains in volume by using the following steps:
Insert the IP address of your WordPress network. (We show you how to obtain this in the section “Obtaining your IP address,” earlier in this chapter.)
Figure 6-10 shows an A record and the Web server's IP address it points to. The domain is sent to that IP address regardless of nameserver.
The Domain Mapping: Domains page appears, as shown in Figure 6-11.
You can get the ID number from the Sites page (Super AdminSites).
The page refreshes and shows you a list of mapped domains.
There is no longer any need to park or point domains at the Web host. The server is instructed to take any domain name request and send it to the WordPress network. WordPress associates the mapped domain with the correct site.
The domain mapping plugin mentioned earlier in the “Installing the Domain Mapping Plugin” section lets you to access the child site by the original location regardless of whether it's a subdomain site or a subfolder site, so you can use domain mapping no matter which set up you chose for your network (subdomains or subdirectories). The domain mapped for the child site is also the domain used on all uploaded media files, which maintains consistency for the site.
In some cases, users may want to hide the original installation domain; for example, if your main installation domain is an obscure looking domain like: http://00954-yourvpsdomain-ba.com, you probably want to hide that domain from showing simply because its not a domain that is easily remembered, or one that will be used, by visitors to your site. If you want to hide the original installation domain, here's how you can do so:
The Edit Site page appears in your Network Admin Dashboard.
The Edit Site page displays in your browser window.
Be sure to click on each of the tabs on the Edit Site page (Info, Users, Themes, and Settings) to change the original domain name to the new mapped domain wherever it appears on the Edit Site page. Keep any folder names intact.
Your mapped site is now inaccessible at the original child site name (the subdomain or subfolder) and any references to it have been changed. Previous links within the body of posts, however, aren't updated automatically, so you need to edit the posts manually to change the links to reflect your newly mapped domain.