Mapping a Large Volume of Domains

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.

Apache configuration

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:

  1. Log in to your Web site with the root user via a terminal.
  2. Navigate to the configuration files in the folder located at /etc/httpd/ by typing
    cd /etc/httpd/
  3. Open the httpd.conf file by typing
    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.)

  4. Press the Insert key to begin editing the file.
  5. Comment out the lines and place the wildcard as shown.
    <VirtualHost *:80>
  6. Save the changes by pressing the Esc key, typing :wq, and then pressing Enter.
  7. On the command line, restart Apache by typing
    /etc/init.d/apache restart

You can now map domains in volume by using the following steps:

  1. Log in to your domain name registrar.
  2. Click the domain name management tools for the domain you want to map.
  3. Click the Total DNS records; refer to Figure 6-5.
  4. Locate the A records at the top of the page.

    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.

  5. Choose Network AdminimageDomains from your WordPress Dashboard.

    The Domain Mapping: Domains page appears, as shown in Figure 6-11.

  6. Enter the ID of the site you want to map.

    You can get the ID number from the Sites page (Super AdminimageSites).

  7. Enter the domain name you want to map to this site.
  8. Click Save.

    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.

Figure 6-10: Domain A records.

image

Figure 6-11: Mapping a domain from the Domain Mapping: Domains page.

image

Hiding the original installation domain

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:

  1. Choose Network AdminimageSites.

    The Edit Site page appears in your Network Admin Dashboard.

  2. Hover over the name of the site you want to edit and click the Edit link that appears, as shown in Figure 6-12.

    The Edit Site page displays in your browser window.

  3. Find all instances of the original domain name and change them to the new mapped domain.

    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.

  4. Save your changes by clicking the Save Changes button, as shown in Figure 6-13.

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.

Figure 6-12: The Edit link for individual sites.

image

Figure 6-13: The Edit Site page in the Network Admin Dashboard.

image

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.213.235