Apache - Modifying directory listings
The directory listing view in Apache is what you see if there is no index.* file in the directory which is being viewed.
In the absence of an index.htm (or index.html, index.php, etc.) Apache may reveal a listing of all files and directories in the directory being viewed.
The may refers to the possibility that this feature might be turned off as some consider it a security risk.
All web directories generally contain an index file and its presence prevents the ability to view a directory listing - the viewer is simply shown the index file itself, which links to other files in the usual way. However if directory listing view is enabled in the Apache server's configuration and there is no index file, then the reader is presented with a view similar to this:
This view can be useful if you use the directory as a repository for files and can't be bothered to create an index file, which hyperlinks to each file listed. An alternative is to leave out the index file and enable directory view in httpd.conf. Under these circumstances Apache makes the list for you and users can download the files by clicking on the list. Nice.
One limitation is that longer file names get truncated in the default directory list view. Hard to read. To widen the view, edit httpd.conf..
This file is the main configuration file for Apache and it is wise to make a backup before modifying it, just in case..
cp /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf.bak
Note that the location of httpd.conf
can vary depending on the system and version being used. Find the following section and add the line in bold below..
To make the changes happen, restart the Apache Service. Again the method may vary..
The new directory listing view should widen to accomodate the longest file name..