Creating the equivalent of IIS Virtual Directories in Apache

I have to admit that I used to be guilty of laziness on one aspect when I began using Linux/Apache a couple of years ago as a convert from Windows. I didn’t immediately understand how to create the equivalent of virtual directories in Apache that are available in IIS. I soon found that I could just do symbolic links at the file level that would effectively give me the same effect at the broswer request level. However, one big negative is that there is a linked directory sitting there in the parent directory, which is a pain in the tail when it things like source control such as subversion comes into play. When I browse to a directory in a terminal or my IDE, I don’t necessarily want to see it either. The answer is to use the “Alias” directive in Apache.


As a ColdFusion developer, I like to have a CFIDE directory available in my webroot as I develop so that I can access the ColdFusion administrator. I keep my CFIDE directory in /usr/local/apache2/htdocs/CFIDE.

To make that available as a virtual directoy, I need to add the following to my Apache virtual host definition:

Alias /CFIDE /usr/local/apache2/htdocs/CFIDE
<Directory /usr/local/apache2/htdocs/CFIDE>
Order allow,deny
Allow from all

Just remember to remove that one before you put it in production!