Here is an example of mod_rewrite for anyone interested, which I use to pull files from a specific directory relating to the hostname requested...
RewriteEngine On
RewriteMap lowercase int:tolower
RewriteCond ${lowercase:%{HTTP_HOST}} blueroo.net$
RewriteRule (.)$ /path/to/web/sites/%{HTTP_HOST}$1
RewriteCond /path/to/web/sites/${lowercase:%{HTTP_HOST}} !-d
RewriteRule (.)$ /path/to/websites/nosite.php
Accessing test.example.com will effectively use /path/to/web/sites/test.example.com as DocumentRoot.
Adding new hosts is as easy as creating the relevant directory.
If a hostname is accessed and the related directory does not exist, it will display the contents of nosite.php
I combine this with DNS records allowing *.example.com to resolve to my site.
Hope this helps
Max