0

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?

agurchand
  • 1,635
  • 3
  • 15
  • 25
  • To prevent it to not parse, you are saying that you want it to parse, so just leave it as it is and it will parse as normal. – Captain Payalytic Aug 29 '13 at 15:47
  • Possible duplicate of http://stackoverflow.com/questions/1271899/disable-php-in-directory-including-all-sub-directories-with-htaccess – haim770 Aug 29 '13 at 15:48

2 Answers2

1

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.

Marcin Orlowski
  • 72,056
  • 11
  • 123
  • 141
0

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)

sunshinekitty
  • 2,307
  • 6
  • 19
  • 31