HTAccess Directory Index with PHP-Files

I'm currently trying to fancy up my directory index a little - To do so, I already managed to create a decent layout around the created table - But now, I need to add some scripting, too.

As I'm most familiar with PHP, I figured I could just replace the

HeaderName /meta/header.shtml

with

HeaderName /meta/header.php

But this results in the file not being included at all. I created a workaround to still work with PHP by adding a SSI to header.shtml, so the file's only content is

<!--#include virtual="/meta/header.php" -->

And then doing all HTML output and PHP scripting in the header.php. Although this works exactly how it should, it still fells wrong. How can I get my PHP-File to be directly included without the SHTML in between?


Solution 1:

After a little research on this, you can set this like this:

HeaderName /path/to/header.php
ReadmeName /path/to/footer.php
AddType text/html .php
Addhandler application/x-httpd-php .php
<Directory /path/to/indexedDir>
  Options Indexes
</Directory>

And that should do it, no security implications (from my comment above).