Disable execution of PHP, Perl, Python, Java scripts using .htaccess for particular folder

Sometimes you may need to disable the script execution in certain directory for the security reasons.

If you are using Apache web server, you can disable it using .htaccess. You just need to add the following code to disable the execution:

AddHandler cgi-script .php .pl .py .jsp .asp .htm .shtml .sh .cgi
Options -ExecCGI

It is recommended that you disable the script execution for your upload, images etc. (where there is no script execution  is required). This is improve the security of your website.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to top
%d bloggers like this: