Built-in Index Goodies

The Apache web server is argueably the coolest thing since sliced bread. On a site I maintain, we have archives of a few public mailing lists. I originally set these up to get mail out of my own in box, and found that it was convenient to have the resources close to me on the web. Subsequently, I have added a search feature and opened it up for public access.
We keep one year’s worth of messages to each mailing list. If for instance you wanted to see our MySQL list archives, you would use this URL:
http://www.jsw4.net/info/list-archives/mysql/
Apache has a default module called autoindex_module, and in general, if the server cannot find a document named index.html in a directory that is publically accessible, it will construct a listing of the files in that directory. (Or sometimes, it will tell the viewer they don’t have permission to view the directory. It depends on the site specific configuration.)
I’ve frequently wanted to change the order that the listing is shown in. For instance, the names in the directory above sort from oldest to newest at the bottom of the list. But users will most frequently want to see the recent entries first.
In noticed the listing is rendered with hyperlinks for column headings. To my pleasure, the interface is as you would expect it (if you know that at least one OS I use allows file lists to be sorted by clicking on the heading of such lists) and by clicking on the name heading I was able to change the default sort order from ascending order of names, to decending order. Notice the URL change that has occured:
http://www.jsw4.net/info/list-archives/mysql/?N=D
By reading the docs, I learned that one can also change the default sort order in the Apache configuration file, by use of the IndexOrderDefault Ascending|Descending Name|Date|Size|Description configuration directive.
Hats off the the folks at Apache, again.

Comments are closed, but trackbacks and pingbacks are open.