Ever wondered how to set up username.domain.com when a lot of users are signing up for your service? Apache module mod_vhost_alias is the answer.
In httpd.conf in the virtual host container, add "UseCanonicalName Off". And instead of "DocumentRoot" you write "VirtualDocumentRoot". The following code: "/dev/account_htdocs/%1.1/%1", given "http://peter.domain.com", resolves to "/dev/account_htdocs/p/peter".
%0 means give me the whole name: peter.domain.com
%1 means give me the first part of the name: peter
%3 means give me the third part: com
%1.1 means give me the first letter of the first part: p
Using the /p/ subdirectory helps when I get 1000s of users because most Oss get slow when a directory has 1000s of subdirectories. This approach spreads it out a bit.