Greg's Blog

helping me remember what I figure out

Adding Virtual Folders to Apache

| Comments

Adding virtual folders to Apache

This document will introduce you to creating virtual folders for the Apache v1.3.12 web server (www.apache.org). I will be talking you through creating a virtual folder with the help if an example, namely by creating such a folder for the ActiveState (www.activestate.com) PERL html documentation.

What we are going to do is create a virtual directory called perldocs, which will give us the following URL http:///perldocs/. The PERL documentation can be found in the following location C:/Perl/html/ assuming you used the default installation settings. You are armed with the basic info, all we need to do know is inform the server of this information.

First you will need to stop your server. Open a command prompt and type:

net stop Apache

This will stop the Apache web server service. Next open your favourite text editor and open the srm.conf file in the conf directory of your server installation by default this should be c:Program FilesApache GroupApache. Before making any modifications to any of your files, remember to make a backup copy first. You will need to add the following lines:

#virtual html documentation directories
Alias /perldocs/ “C:/Perl/html/”

So your file should look something like this

#
# This is the default file for the ResourceConfig directive in httpd.conf.
# It is processed after httpd.conf but before access.conf.
#
# To avoid confusion, it is recommended that you put all of your
# Apache server directives into the httpd.conf file and leave this
# one essentially empty.
#

#html documentation aliases
Alias /perldocs/ “C:/Perl/html/”

Save and quit your editor. When you restart your server Apache (from the command prompt type net start Apache) will load the configuration file after processing the httpd.conf file. Open your browser and point it to the aforementioned URL. It should be noted that when you create the aliases (e.g. perldocs), when you enter the URL make sure that your entry is case-sensitive. Failure to so will result in an error 404 being returned.