Can I make a vhost on apache to respond to a cname request? For example:
A-record of example.com is 1.2.3.4
foo.example.com is a CNAME for example.com
in http.conf:
<VirtualHost *:80>
ServerName example.com
DocumentRoot /var/www
</VirtualHost>
<VirtualHost foo.example.com>
ServerName foo.example.com
DocumentRoot /foo/www
</VirtualHost>
apache starts fine and digests my conf, but when I visit foo.example.com I get the content in /var/www, not the one in /foo/www. I think I'm on the wrong track here.
Best Answer
The following snippet should work (without any warning):
Make sure you read the documentation on Name-based Virtual Host Support to understand why it didn't work in the first place.