Let me preface this post by saying I only do this on my local Apache install, running on my local machine. I'm sure actual server admins would suggest an alternative way to handle such things on production servers. Consider this a quick and dirty mod that only caters to
my your obsessive-compulsive disorder.
Nevertheless, as of Apache 2.2, which comes installed with Leopard, there's a new directive in mod_autoindex by the name of IndexStyleSheet.
According to the documentation:
The IndexStyleSheet directive sets the name of the file that will be used as the CSS for the index listing.
Basically, all you need to do is make sure the following autoindex Include is uncommented in Apache's conf. For Leopard, httpd.conf is located here:
Right around Line 450 is the autoindex conf Include—make sure it's uncommented:
Then, open up the autoindex conf in the editor of your choice:
Near the bottom of the file, add the following line, as is suggested in the documentation (you can name the directory and CSS file anything you like):
Finally, create said directory in your main DocumentRoot, create the aforementioned CSS file inside the folder and restart Apache.
It's up to you to style the directory index to your liking—look at the HTML source to get the structure. If you're feeling lazy, you can grab my CSS on Pastie. Note: after restarting Apache, changes to the CSS file will take effect with a simple refresh.
While not necessarily a helpful tip that will save you time and money, it will definitely spruce up those default Apache directory indexes. I develop locally, so I spend quite a bit of time looking at them.