How to create a wildcard sub-domian?

3 posts / 0 new
Last post
#1 Sat, 12/04/2010 - 22:49
kfawcett

How to create a wildcard sub-domian?

I am trying to install Wordpress MultiSite and in order to do so it says to create a wildcard sub-domain. How, or can, I do this in Virtualmin? If not, can someone help with setting it up in Apache? I'm not exactly sure where/how to do it. The documentation from wordpress is vague: http://codex.wordpress.org/Create_A_Network

I've found some blogs that say you only need to create a virtual domain in cPanel (I've read here about the difference between Virtualmin's sub-server and cPanel's sub-domain, but I'm getting confused with all the nomenclature). I've noticed mutiple VirtualHosts in Apache that are related to my Top-level Server and the sub-servers related to it, but I'm unsure where to stick the wildcard sub-domain. For reference, I have:

example.com subdomain1.example.com subdomain2.example.com
subdomain3.example.com and so forth

So now I need a wildcard sub-domain.

Below is the step that talks about setting up the wild card domain in the wordpress documentation:

Step 2: Setting Wildcard Subdomains (If this is a Sub-directories Install, skip this step.)

Sub-domain sites work with the use of wildcard subdomains. This is a two-step process:

  1. Apache must be configured to accept wildcards. Open up the httpd.conf file or the include file containing the VHOST entry for your web account. Add this line: ServerAlias *.example.com
  2. In the DNS records on your server, add a wildcard subdomain that points to the main installation. It should look like: A *.example.com

Any ideas?

Sun, 12/05/2010 - 04:32
Locutus

Yep, an idea would be to check out the function Server Configuration -> Website Options : Website matches all sub-domains. That should do it. :)

When this option is enabled, requests for any URL under the domain (like http://abc.example.com) will return the virtual server's website. This can be useful if you host an application that can return different content based on the requested domain name, such as Wordpress MU. If the virtual server's DNS domain is hosted on this system, Virtualmin will also add the wildcard * DNS record when Yes is selected.

Sun, 12/05/2010 - 10:11 (Reply to #2)
kfawcett

Thanks Locutus. That's what I was looking for. Fortunately I figured it out last night and changed it through httpd.conf, but I forgot to update this. I just looked at the website options in Virtualmin and sure enough the change in apache's httpd.conf is reflected in the "Website matches all sub-domains?" option.

Topic locked