Quick Tip - Make Apache's Directory Indexes look nicer on mobile

This post is more than 2 years old.

If you use Apache, then you most likely have DirectoryIndex enabled on your development server. This is the feature that lets you request a directory without a home document and see a list of folders and files. This is not normally enabled in production, but in certain circumstances it may be. (For a file download directory perhaps.) If you do any testing with mobile devices though you will probably find this index to a be a bit hard to read. Here's an example.

You can pinch and zoom to make that a bit easier to read, but it's a pain in the rear. Turns out Apache has a few options that allow you to customize how this index file is created. One of them, IndexHeaderInsert, allows you to add HTML to the head section of the document. I added the following to my Apache httpd.conf file:

And the result was exactly what I needed:

Hope this helps!

Raymond Camden's Picture

About Raymond Camden

Raymond is a senior developer evangelist for Adobe. He focuses on document services, JavaScript, and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA https://www.raymondcamden.com

Archived Comments

Comment 1 by fritz posted on 2/28/2013 at 3:19 AM

Your filter has just flagged my comment as spam... perhaps you need to relax it a bit

Comment 2 by Raymond Camden posted on 2/28/2013 at 3:26 AM

I'll check the logs I suppose. Sorry!

Comment 3 by Ruud Harmsen posted on 11/24/2014 at 9:35 PM

Great tip, it really works, thanks!