Make Virtualhost detect Wildcard with and without preceding www
Posted
by
jasondavis
on Server Fault
See other posts from Server Fault
or by jasondavis
Published on 2012-09-09T18:09:45Z
Indexed on
2012/09/25
3:40 UTC
Read the original article
Hit count: 456
apache2
|virtualhost
In my Apache (Xampp) httpd-vhosts.conf
file I have added this Virtualhost
It allows me to use Wildcard names like testserver1.dev
and testserver2.dev
I just have to make sure to add the name to my Windows Hosts file.
<VirtualHost *:80>
VirtualDocumentRoot E:/Server/htdocs/projects/%1/www
ServerAlias *.dev
</VirtualHost>
What I would like to do though is add to this funtionality and make it work if the name begins with a www
so testserver1.dev
would also work as www.testserver1.dev
The way it currently is set up, if I tried to access that URL, it would look in a folder called www.testserver1
instead of the folder testserver1
© Server Fault or respective owner