I'm setting my Apache2 Virtual Hosts, in a Debian Squeeze server, in this way:
Alias /whatever /var/www/whatever.mydomain.com <VirtualHost *:80> ServerAlias whatever.mydomain.com ServerAdmin firstname.lastname@example.org VirtualDocumentRoot /var/www/%0 ErrorLog /var/log/apache2/whatever.mydomain.com-error.log CustomLog /var/log/apache2/whatever.mydomain.com-access.log combined </VirtualHost> <Directory /var/www/whatever.mydomain.com> AuthPAM_Enabled On AuthType basic AuthName "Authorization Required to proceed" AuthBasicAuthoritative off AuthUserFile /dev/null Require valid-user </Directory>
I would like to serve the same site with two URL's: whatever.mydomain.com and www.mydomain.com/whatever
So to help this issue I've configured the Alias /whatever /var/www/whatever.mydomain.com in the start of file. But I'm not aware if this is a good practice. And about the VirtualHost setting? There's something that can be done better?
And last question: there's a way to use variables inside of the file? As example repeat the %0 in other places than VirtualDocumentRoot?
Thanks in advance,
EDIT: I've got a new problem. With the global alias, all my virtualhosts will answer to the /whatever alias, and I only want the alias being applied on www.mydomain.com. I'm struggling with RedirectMatch without success at this moment. I'm using redirect instead of alias because with alias the access and error log don't get in the virtualhost log file.