« Blog Home

§ Format apache directory listing

The default directory listing apache shows is controlled by mod_autoindex and it has some options available.

I wanted to be able to see some long filenames.  I searched... I searched.  So I gave up and looked for scripts that would do it.  I found http://autoindex.sourceforge.net/.  Nice, but not quite what I wanted; I still wanted the links to be direct to the file.  So I started writing.  It's actually quite easy– wait, some of the folders I want to use this on are on a different volume from DOCUMENT_ROOT, via a symlink.  Umm, ok, I'll get this figured out in a minute...

So now I'm searching for something else, but up pops in my google results The Answer:  mod_autoindex.

The IndexOptions directive allows a whole bunch of, ahh, options for the index.  In .htaccess, I put

IndexOptions NameWidth=*

and now it shows the whole filename.

Naturally I got pretty excited by this, so I also added more stuff:

IndexOptions NameWidth=* FancyIndexing FoldersFirst HTMLTable SuppressHTMLPreamble
HeaderName /dirlistheader.html

In /dirlistheader.html I included some css so now I have purty file lists!

Well, ok, maybe not pretty, but I like it better.

last edited on January 14th, 2010 at 10:26 AM


No Comments Here. Add yours below!

Add your comment

Email: (Will not be displayed - Privacy policy)
  random image I can't read it!
Give me a different one!
Verify Post: Input the text from the image above to verify this post (helps prevent spam)

« Blog Home

“History, dear,” said Jerry.  “That stuff you disapprove of, where most problems had to get solved before, and we don’t learn anything from.”
Jerry, Pyramid Power, Eric Flint & Dave Freer