
Chapter 6. Handling directories
Syntax summary: dir_module
DirectoryIndex
Specify the documents to be searched for given a directory query.
Document names are resolved relative to the directory queried unless they start
with a / when they are resolved relative to the document root.
Automatic indexing of directories
The second approach we will consider is that of automatically generating a list of the
entries in the directory.
The relevant module is rather old and clunky, hailing back to the days when browsers
didn’t support tables in HTML, but it is in very widespread use so we need to con-
sider it. We will start by loading the module and removing dir_module (for simplicity
at this stage).
This is also the largest module (in terms of number of commands) we will cover in
this course. If you can cope with this one, you can cope with any of them.
LoadModule autoindex_module modules/mod_autoindex.so
Figure 6-4. httpd.conf: Loading autoindex_module
If we just load the module then we see that, instead of getting a 404 “Not found” error
we get a 403 “Forbidden” error instead. The web server now knows how to handle
directories but has decided not to.
Figure 6-5. Refusal to handle a directory
As with symbolic links above (see Chapter 5) we need to set an option to instruct the
module to do its job. Note that this use of Options follows the loading of the module.
33
Comentarios a estos manuales