Friday, April 16, 2010

Apache Directory Indexing – How to Change the Name Column Wide


Sometimes we need to simply share our files with Apache, by placing those files into web server directories, so that other people can browse them. But a pity, the default preview of Apache directory indexing is sometimes unreadable, or maybe less nice for user.

One of common problem with the default directory indexing is that the column for file/directory name has not enough wide to show the complete name.

Here is the example of this problem:



You can see that there are two file having almost the same name. We have to mouse-over the index and look at the status bar to see the complete name. There is a simple way to solve this problem. Just tell Apache to make the column wider; by configure the Apache directory indexing in Apache configuration file.

Open your Apache configuration file (/etc/apache/httpd.conf). Change the configuration by adding the following option in the directory option:

IndexOptions NameWidth=*

Instead of using the "*" character you can give a number, this will cause the width of the filename column to expand as wide as we need.

i.e.:
IndexOptions NameWidth=45

Save and close the httpd.conf. Once we have restarted the Apache, we will have a much more readable index:


You can get more directives to configure your directory indexes from the directory indexing module
mod_autoindex documentation.

No comments:

Post a Comment