Trouble with mod_autoindex


After server change, some directory handling code is no longer working. It seems to be that if I put a “HeaderName filename” directive in, the header goes in fine, but the listing becomes garbage characters. Without the header, it works fine.

I believe php is a fastcgi instead of mod now, as I had to change a handler name in our main htaccess file to get our basic web stuff to work, but no idea how that is related.

Any hints on what to do or other issues with autoindex after moving servers?
I have even tried a simple test header and it has the same problem.

In case it is related to the php, my main htaccess file is:

AddHandler php5-cgi .html
AddType text/html .html
SetEnv TZ America/Denver

Edit to add: The cgi handler seems to cause the issue. But I need that so still need a solution to mod_autoindex garbling the listing. I have a simple test set up at


As far as I can tell, there’s a conflict between “AddHandler php5-cgi .html” and having a HeaderName file that’s also HTML. (My guess is that it’s trying to run it through PHP, and that’s not working as expected.) I’d consider giving the HeaderName document some other extension (.inc, perhaps?) to keep PHP from trying to mess with it.


Wish I could solve it that easily. But the real header (and real footer) have php code in them. When the handler was the builtin php as a mod, it worked but that is now gone and we have php as a cgi :frowning:

It is some kind of confusion resulting from that I am sure…but am totally at a loss as to what.

I also opened a ticket with DH, will see if they have any idea how to fix it (and will post any solution back here of course).


Well a partial fix…and more wierdness. The DH gurus tried using a HTTP header that did not accept compressed output and it worked, so we disabled mod_deflate on my site. Now it works but at a cost!

The HeaderName file was being served as compressed output and the file list was not.

But even with the workaround…When I use a HeaderName and ReadmeName with mod_autoindex, the sequence that comes out now is header, then footer, then the listing. So some strangeness still remains. I’m thinking this is apache bug at this point and thinking about ways around it.


Well it is an apache bug. Got around it by writing own php dir listing (actual grabbed one of many and modified it) and not using mod_autoindex.

MR with apache is