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:

Apache index page with narrow columns

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:

Apache index page with wider columnsAh… much better. The columns auto-adjust.

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.

LEAVE A REPLY

Please enter your comment!
Please enter your name here