Set the Column Width of Apache Directory Index Pages
TL;DR Summary: Maximize the visibility of your directory index page by adjusting column width in your .htaccess file. Learn how to enhance file name readability and presentation effortlessly. Dive into the details and make your directory listings more user-friendly. Ready to optimize your directory view? Let's get started!
This is simple, but I find myself often having to look it up, so I thought I’d write up a quick how-to about this.
To show a directory index page, you may need to first create a .htaccess file in the directory your want to show the contents of (and make sure there’s no index.html file there or default document file there) and include this:
Options +Indexes
And, for some reason, the creators of the Apache web server thought that showing narrow columns was cool:
It’s not cool, man. You can’t really see the file names.
I don’t know why they didn’t make this feature work this way by default, but to fix it, add this extra line into your .htaccess file:
IndexOptions NameWidth=*
And you’ll get something like this:

If for some, bizarre reason you wanted to set the column width for the Name column, you would do this instead (the number of characters):
IndexOptions NameWidth=40
But, just know… you’re weird, man.
📄 Download a PDF of This Article


