There are several ways to set up virtual hosts on your web server. One of the more common methods is to manually create a <VirtualHost> record for each virtual host. While using this method is fine, it can end you up with a huge configuration file that is difficult to manage.
Because all of my virtual hosts are sub-directories of my web server’s base directory, I prefer to dynamically allocate the virtual host directory based on the host name. For example, I want wildlyinaccurate.localhost to point to /var/www/wildlyinaccurate. This can be achieved by modifying the .htaccess file of your web server’s base directory: Continue reading