Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

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
add comment

1 Answer

up vote 1 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
</Directory>

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

share|improve this answer
add comment

Your Answer

 
discard

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.