Styling Apache Indexes
The default output of Apaches Options +Indexes
doesn’t look good at all. Very 1990 something… But - as with pretty much any open source open source software - there are tons of options, which enable you to change everything to your likings!
The contents of .htaccess
# default order: descending by name
IndexOrderDefault Descending Name
# set the following options:
# - ignore case
# - don't display the description column
# - display folders first
# - set the width of the name column to 40 chars
# - don't display the default HTML output (doctype, head, ..., starting <body> tag)
# - use Fancy Indexing
# - set IconHeight und Width to 16 pixels (FamFams Icons use these dimensions)
IndexOptions +IgnoreCase +SuppressDescription +FoldersFirst +NameWidth=40 +SuppressHTMLPreamble +FancyIndexing +IconHeight=16 +IconWidth=16
# we want to use indexes for this folder!
Options +Indexes
# the header template, which is displayed before the list
HeaderName ../list_header.html
# the footer template, which is displayed after the list
ReadmeName ../list_footer.html
# don't display the link to the root folder
IndexIgnore ..
# set the default icon to a fancy famfam icon
DefaultIcon ../images/bricks.png
To see it in action visit the Typogridder download folder. Also take a look at the header template and the footer template.
Note: The icons I use are created by Mark James. Kudos and thanks go to him, for creating such beautiful and free icons!
Going Further
If you want to see what more is possible to do with apache, take a look at the following sites:
- the documentation of mod_autoindex lists all settings, must read! ( Note: this link is for Apache 2.0, for older servers, i.e. version 1.3, see mod_autoindex 1.3 docu)
- Apache Indexes 101 and Apache Indexes 201 by Tom Sherman
Comments
Want to comment? Send me an email!
Comment by Diego (not verified) (2013-02-13 13:50:00)
Thank you very much for sharing this! It was exactly what I was looking for.