Tuesday, June 27, 2006

HeaderName and PHP scripts execution problem

If you are using mod_autoindex to list your directory contents on the web, you may want to add header and footer using HeaderName and
ReadmeName directives.

However, if you refer to .php scripts in these directives, they are
either ignored or listed as plain text(php source).

In order to have HEADER.php really executed, you need to add in your httpd.conf some code like:
 
<Directory /dir>
AddType text/html .php
HeaderName /HEADER.php
<Files "*.php">
AddHandler application/x-httpd-php .php
</Files>
</Directory>

4 comments:

Anonymous said...

Thanks! This was really driving me crazy until I found this tip! :c)

Anonymous said...

Hear hear! Very handy! thank you :D

Ana Aman said...

Yes, it took me a while to figure out this, apache documentation seems to lack it.

Loren said...

Awesome, thank you!