Splash of Style...Macs, Photography, Design, and other Passions

Apache Aliases

August 17, 2004 by debbie T | Apache

I couldn’t be without the Apache web server on my Windows system for offline testing. But keeping all web files saved in the “htdocs” folder in Apache can be annoying. This is where defining an alias in the Apache httpd file will allow you to save web files anywhere on your system.

Open the httpd.conf for configuring Apache.

Search for:

# Aliases: Add here as many aliases as you need (with no limit). The format is 
# Alias fakename realname

A few lines under, there might be an alias already set up. For example:

Alias /icons/ "D:/My Documents/My Webs/Apache/icons/"
    <directory "D:/My Documents/My Webs/Apache/icons" >
        Options Indexes FollowSymlinks MultiViews Includes
        AllowOverride None
        Order allow,deny
        Allow from all
   </directory>

Add as many aliases as you need, listing the path to the folder on your hard drive, using the same format as previously listed. In fact, you might want to copy and paste then change each path.

Important: If you are utilizing Server Side Includes (SSI) you must make sure the text “Includes” is listed or SSI will not render properly when testing in Apache. “Options Indexes FollowSymlinks MultiViews Includes” – See my example below.

#alias for Blogging folder 
Alias /blogs "D:/My Documents/My Webs/blogs"
        <Directory "D:/My Documents/My Webs/blogs">
            Options Indexes FollowSymlinks MultiViews Includes
            AllowOverride None
            Order allow,deny
            Allow from all
    </Directory>

You can use #comment lines to note a description for the alias to make it easy to understand at a later time.

Make sure to restart Apache.

I found this tutorial to be very helpful in learning about aliases.

Good luck!

Commments are closed for this article.