[Pmwiki-users] Re: more thoughts on .htaccess

Joachim Durchholz jo
Tue Dec 7 05:26:37 CST 2004


Gunnar Wagenknecht wrote:
> What you wanna do is to disallow some file extensions and to 
> downgrade scripts (php) to text files.
> 
> AddType text/plain .php

This doesn't help - all it does is instruct Apache to consider the 
output from the PHP script as text/plain. You have to use the AddHandler 
directive to disable scripting. (There's a handler that will convert PHP 
source code to nicely syntax-highlighted and nl2br-converted HTML code, 
which is usually associated with .phps files - I forgot its name, but 
Google should find it easily; I'd expect that it comes with the mod_php 
module and would be perfect for preventing .php files from executing, 
just associate that handler with .php and .php3 instead of the usual PHP 
handler.)

Actually it's better to disallow downloads in general, then the handler 
associated with .php files doesn't matter.

Regards,
Jo
(who just configured several servers, but may still be occasionally 
wrong - Apache is a far too complex beast)



More information about the pmwiki-users mailing list