Disable PHP in a directory

Discussion in 'PHP' started by Druciak, Nov 15, 2010.

  1. Druciak

    Druciak New Member

    How can I disable php in some directory?
  2. NiteWave

    NiteWave Administrator

    can use rewrite rule to prevent it.
    in .htaccess at that directory:

    RewriteEngine on
    RewriteRule (.*)php$ - [F]
  3. Druciak

    Druciak New Member

    I try to use
    'php_flag engine off' in a .htaccess file in that directory but its not working.
  4. webizen

    webizen New Member

    Do not use 'php_flag engine on/off' in .htaccess for now. It will be supported in the future releases.

    php is handled by External Handler (lsphp5 by default). To disable php per directory, .htaccess is the way to go:

    1. turn on .htaccess for the vhost (Vhost->General->HTAccess -> check FileInfo at least)

    2. to block php (HTTP 403 returned), put the following lines in the .htaccess under the directory desired:
    Options -ExecCGI
    AddHandler .php
    or the rewrite rules NiteWave suggested above.

    or

    2. to block php but allow source to display, put the following line in the .htaccess:
    RemoveType .php

Share This Page