UPDATE 1:
I now have the following:
<VirtualHost *:80>
ServerName www.companyname.com
DocumentRoot /www/html/www.companyname.com/
</VirtualHost>
<VirtualHost *:80>
ServerName test.companyname.com
DocumentRoot /www/html/www.companyname.com/test/
</VirtualHost>
Which does not work when I type into the browser
http://test.companyname.com
However, when I restart apache, I get a message saying
Stopping httpd: [ OK ]
Starting httpd: [Tue Apr 05 10:49:48 2011] [warn] _default_ VirtualHost overlap on port 80, the first has precedence
[ OK ]
ORIGINAL QUESTION:
How do I configure apache so I can have many sub domains along with my main domain?
for example, google has
www.google.com mail.google.com docs.google.com
how do I do the same, but get the sub domain to go to a different directory and or web page on the website?
We use a LAMP configuration on RedHat linux.