Wildcard VirtualHost with Apache2
Set your ServerAlias directive to *.domain.tld - Here is a quick example.
<VirtualHost>
ServerName example.com
ServerAlias *.example.com
DocumentRoot /var/www/path/to/site
</VirtualHost>
Now everything.example.com and anything.example.co...
Written by Sean Behan on 06/17/2012