Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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


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?

share|improve this question
To me, that is a perfect hack. Another ways is to use "AddType text/html .php" and "AddHandler application/x-httpd-php .php" but i am not aware of the security implications this could have. – Torian Sep 30 '10 at 21:18
up vote 2 down vote accepted

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

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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.