Fancy Apache Tricks

TorgoX on 2002-05-11T22:06:20

Fancy Apache tricks:

In the <IfModule mod_autoindex.c> section of httpd.conf, add:
   HeaderName /.index_header
(instead of "HeaderName HEADER")

Then in htdocs, create an .index_header.html file consisting of just:
  <link rel="stylesheet" type="text/css" href="/.index.css">
And maybe add a
  <meta name="robots" content="NOINDEX, NOFOLLOW">
line too.

Then still in htdocs, create an .index.css file consisting of:
BODY {
  background-color: black;
  color: white;
}

A:link { color: #6060FF }
A:visited { color: #A060FF }
A:active { color: #FF9090 }

ADDRESS {
  font-family: sans-serif;
  text-decoration: none;
  text-align: right;
  color: #303030;
}

What this all does:

* Pretty colors for all directory listings, via the stylesheet!

* Suppresses the annoying "<H1>Index of /foo/bar/baz/quux_quux_quux</H!>" thing. Those things annoy me because they're redundant next to what shows up the <TITLE>...</TITLE> as well as in the current URL; and because they stretch the screen out if "/foo/bar/baz/quux_quux_quux" is particularly long and has no spaces in it.

The downside: You can't use HEADER.html files, as you could before.

Also, on an unrelated point, in httpd.conf, most people can get away with changing
   IndexOptions FancyIndexing
to
   IndexOptions SuppressDescription FancyIndexing
...since few people ever use that Description field.