agurchand
agurchand

Reputation: 1665

Prevent PHP parsing in a particular folder

I am trying to prevent a particular folder to parse PHP files. I have used the following code in .htaccess

php_flag engine off

It is giving me 'Internal Server Error'

Then I tried this:

<IfModule mod_php5.c>
   php_flag engine off
</IfModule>

But, the second one doesn't seems working. How can i prevent the particular folder other than this?

Upvotes: 0

Views: 489

Answers (2)

sunshinekitty
sunshinekitty

Reputation: 2375

If you're using mod_php, you could put (either in a .htaccess in /USERS or in your httpd.conf for the USERS directory)

RemoveHandler .php

or

RemoveType .php

(depending on whether PHP is enabled using AddHandler or AddType)

Upvotes: 0

Marcin Orlowski
Marcin Orlowski

Reputation: 75645

Both are exactly the same. <IfModule> got nothing with PHP. Please check Apache docs. And you got 500 from your httpd, because you got AllowOverride None set in httpd's config, so all php_flag will cause this error. You need to enable it, by setting it to (at least) AllowOverrides Options, and restarting your httpd.

Upvotes: 1

Related Questions