Using Apache Aliases Instead of Symbolic Links

Having to spend more time working in a Windows environment has been heart-breaking, but I’ve been able to find work-arounds for most of Windows’ shortcomings, including Windows’ lack of adequate symbolic link functionality for use with web development.

For a new web project, I usually create a symbolic link in the DocumentRoot directory which points to the project’s development files.  Then I just visit http://myserver/projectname to check my progress.  However, Windows doesn’t support symbolic links.  The solution is to use an Alias directive in my Apache configuration file.  Aliases are enabled by the mod_alias Apache module.

In this case, I wanted to create a directory for new vWorker projects, so I created the directory and added the directive:

Alias /vworker "C:/Users/ghodmode/dev/vworker"

If that’s the only change I make, then it’s likely that I’ll get a 403 HTTP Error Page (Access Forbidden) when I try to view the files, so I’ll also need to add a block to the configuration file that allows the HTTP server to serve files from the directory:

<Directory "C:/Users/ghodmode/dev/vworker">
 Options Indexes FollowSymLinks Includes ExecCGI
 AllowOverride All
 Order allow,deny
 Allow from all
 RewriteEngine on
</Directory>

That’s probably a little less secure than it should be for a production server, but this is a development server and it isn’t accessible from the Internet.  The important line is “Allow from all”.

Now just restart the HTTP server and visit the page.

This entry was posted in Apache, sysadmin, tips, Web D., Windows. Bookmark the permalink.