Skip Links

Network World

  • Social Web 
  • Email 
  • Close

(Comma separation for multiple addresses)
Your Message:

Showing long file names in Apache directory listings

Dr. Internet By Steve Blass , Network World , 05/15/2006
Steve Blass
  • Share/Email
  • Tweet This
  • Comment
  • Print

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.

  • Share/Email
  • Tweet This
  • Comment
  • Print
Comments (6)
Login
Forgot your account info?

Showing long file names in Apache directory listingsBy Anonymous on January 26, 2007, 12:31 pmThis is not about long names. DUCKS!!!

Reply | Read entire comment

It works!By Ben on July 2, 2007, 9:28 pmGreat help and it works perfectly! Just don't forget to comment this directive so you can remember what it is referring to later on. You can make comments in...

Reply | Read entire comment

Thanks!By Anonymous on May 10, 2008, 6:05 pmJust added the "IndexOptions NameWidth=*" line to a .htaccess file and it works like a charm in that folder and it sub-folders.

Reply | Read entire comment

Thanks!By Anonymous on September 7, 2008, 12:22 pmFor years I was wondering how to do that, many thanks for the tip!...

Reply | Read entire comment

Fantastic... By Anonymous on July 9, 2009, 3:11 pmI searched google for "apache .htaccess allow long filenames" and it was the second link.. problem solved... many thanks for posting this trick.

Reply | Read entire comment

Apache NamesBy Anonymous on December 26, 2009, 11:10 pmMercer - Eoff

Reply | Read entire comment

View all comments

Add comment
Anonymous comments subject to approval. Register here for member benefits.
Have a NetworkWorld account? Log in here. Register now for a free account.

Videos

rssRss Feed