Showing long file names in Apache directory listings

We use the directory index listing feature to display the directory of our document archive on an Apache Web server. Long file names are getting chopped off by Apache in the generated Web pages. Can we configure the server to show the entire file names in directory index listing pages?

Yes - Apache versions 1.3.2 and later can use configuration directives provided by the mod_autoindex module to customize the appearance of automatically generated directory index listings. To do this, use the NameWidth option available as part of the IndexOptions directive.

This directive can be used in the main server configuration file, a virtual host or directory configuration section, or in a directory-level htaccess file. Place a line in your configuration that looks like "IndexOptions NameWidth=*". The asterisk is a wild card that tells Apache to give as much space to the file name column as needed to show the longest file name in the list.

You can set a specific width by replacing the asterisk with the number of characters you want to use for the column. Other options include FancyIndexing to show file and folder icons, and FoldersFirst to tell Apache to list folders above file names in directory listings.

Join the Network World communities on Facebook and LinkedIn to comment on topics that are top of mind.

Copyright © 2006 IDG Communications, Inc.

SD-WAN buyers guide: Key questions to ask vendors (and yourself)