WordPress Networks and Domain Mapping on Apache 2.x

The intent of this post is not to cover standard domain mapping for networked WordPress blogs; instead, this post describes how to set-up second-level domain mapping for WordPress network blogs when WordPress is not the CMS for your primary domain.

In other words, let’s say you have a site example.net which is your company’s primary site. This is your company’s public facing website, and you have set up a CNAME for it at www.example.net and both of them are run off the same Apache 2.x name-based virtual host. You also have a site intranet.example.net which is the corporate portal your company’s employees use for web-mail, file hosting, and human resources data. This is just another CNAME that resolves to the same IP address as the company’s public facing website; another Apache 2.x name-based virtual host processes the incoming domain-name, and, in this case, it actually acts as a proxy to an internal IIS server which hosts the portal software.

So, Apache is handling all of your incoming web traffic and re-routing it appropriately. Now, one of the department managers (we’ll call him Fred) decides he wants his employees to be able to set-up their own blogs. You install WordPress 3.x and create a network. The WordPress installation is just another Apache name-based virtual host mapped to blogs.example.net. All of Fred’s employees now have blogs with addresses like blogs.example.net/fred. Fred isn’t happy about this, though, because he wanted his blog to be fred.example.net, and he sends what he thinks is an angry e-mail to your boss saying so much. Your boss thinks Fred is crazy, but because Fred’s mother is the CEO who put him in that job so she didn’t have to listen to him whine about not having a job, your boss asks if you can do anything about it.

You have a couple options:

When you install the WordPress MU Domain Mapping plugin, though, you realize that it requires Apache to be routing the new domain into the original name-based virtual host. Since you already have another system accepting wild-card domains for the server, how do you go about this? Answer: ServerAlias.

The Breakdown