
Chapter 6. Handling directories
Figure 6-22. Putting subdirectories first in the listing
Note: By now you may be starting to get confused about when a facility stands alone as
a command like IndexIgnore and when it is an IndexOptions option like FoldersFirst.
Me too.
Adding icons to the listing
The next prettying up of the listing will be to add icons to the listing. Typically, icons
are used to represent the MIME content type of the file. We will use the icons in the
/var/www/icons directory which are provided for this purpose.
We are immediately presented with a problem. The icons directory is not in either
web site’s DocumentRoot. To make it available to all our web sites we are going to
introduce another facility: aliasing. This comes courtesy of the alias_module module
and its Alias command.
LoadModule alias_module modules/mod_alias.so
Alias /icons/ /var/www/icons/
Figure 6-23. Setting up an alias
The Alias command overrides the DocumentRoot for specific URLs. In this case any
URL whose local part starts with /icons/ (n.b. the trailing slash) will be looked up
in /var/www/icons/. Is we place this directive before the definitions of the virtual
hosts then it will apply to both.
Once the module has been loaded, the Alias command may be run multiple times,
both inside and outside of the virtual host sections. If it appears within a virtual host’s
paragraph then it applies to just that virtual host.
The file icon.sheet.png in the icons directory gives a quick lookup of all the icons
provided. Now we have access to the icons we need to know how to make use of
42
Comentarios a estos manuales