One thing I got to hear about at DrupalCon during the Q&A at Sacha Chua's Totally Rocking Your Development Environment was someone who popped up quick and mentioned the utility of VirtualDocumentRoot, a directive for Apache which lets you automatically go find the folder to server the site out of based on the incoming host header.
I created one VirtualHost called all.conf. The virtual host has a ServerAlias * (I'm sure there's a cleaner way to do this, like just in the default config, but I already had this pretty close, so this was a bit of magic). My all.conf looks like this, though you probably don't need the <Directory> portion.
<VirtualHost *>
UseCanonicalName Off
VirtualDocumentRoot /var/www/%0
ServerAlias *
LogLevel Debug
<Directory "/var/www/%0">
AllowOverride all
allow from all
Options +Indexes
</Directory>
</VirtualHost>
The %0 says "look for a folder with exactly what's typed in as the host header" (so not good if you want www.domain.com and domain.com served from the same, for that we used VirtualDocumentRoot "/var/www/%-2.0.%-1/").
So now, I just create a new folder, i.e. 'redfinsolutions' inside /var/www, then I go over to /etc/hosts (or c:\windows\system32\drivers\etc\hosts) and add "127.0.0.1 redfinsolutions" and voila!
Post new comment