Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have configured apache2 virtual host with a sub domain in the following way:


<VirtualHost *>
  ServerName website.local
  DocumentRoot /home/myname/dev/website/web/

/etc/hosts website.local

And it works! Both http://website.local and http://sub.websitel.local point to DocumentRoot. Now, how do I reconfigure this, so that any subdomain http://*.website.local will point to DocumentRoot?

share|improve this question
up vote 3 down vote accepted

you can use a wildcard to match any subdomain name in apache:

serveralias *.website.local

the problem is the hosts file doesn't support wildcards. if you use a local dns bind service as a resolver you can register the website.local zone and create the dns wildcard as well.

share|improve this answer
Thank you, that's it. For instructions on setting up DNS for this look here:… – Dziamid Oct 8 '10 at 19:44

In apache.conf:

ServerAlias *.website.local

However it is not possible to use wildcards in /etc/hosts. You would need to setup a DNS server for that.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.