Previous Section  < Day Day Up >  Next Section

Recipe 22.18. Making Full-Length Directory Indexes

22.18.1 Problem

You have some pages that contain indexes of downloadable files. Apache displays your directories like this, chopping off the filenames:

Parent Directory        27-Jul-2004 09:39      -  

 libpam-smbpass_3.0.5..> 27-Jul-2004 09:17   298k  

 libsmbclient-dev_3.0..> 27-Jul-2004 09:17   581k  

 libsmbclient_3.0.5-1..> 27-Jul-2004 09:17   467k

How can you make it show the entire filename?

22.18.2 Solution

In httpd.conf, find:

# IndexOptions: Controls the appearance of server-generated directory

# listings.

IndexOptions FancyIndexing VersionSort

and add the NameWidth directive:

IndexOptions FancyIndexing VersionSort NameWidth=*

Using the asterisk tells it to expand to the width of the longest filename. You might want to set a limit of something like 40 characters, to keep it readable in case a very long filename slips in:

IndexOptions FancyIndexing VersionSort NameWidth=40

22.18.3 Discussion

You can also configure this for individual virtual hosts; VirtualHost directives override the global directives.

22.18.4 See Also

  • http://localhost/manual/mod/mod_autoindex.html

    Previous Section  < Day Day Up >  Next Section