Apache2's mod autoindex allows to include a header and a readme files, that I configured this way in the directory's .htaccess:
ReadMeName footer.html
HeaderName header.php
For some obscure reason, the header file is not read if it is a .php. I renamed it to header.html and in the htaccess too:
HeaderName header.html
and it worked perfectly (even when in .html it included <?php ?> markups)
Why does apache do hat, and is there a way to fix it?
Per the manual on mod_autoindex / HeaderName directive:
...while a
.phpfile's content-type is defined asapplication/x-httpd-php, even if the script's output is by defaulttext/html. However, there's hope yet. You can actually get the PHP parsed by adding the following combo into your.htaccessbefore yourHeaderNamedirective:Neither of the two on their own will do the job. I presume that here Apache (tested on 2.4) first sets a handler and parses the
.phpfile, and then agrees to understand that the output type is majorlytext/htmlindeed. I'm calling this quirky, but it's working!