Block PHP Execution With .htaccess In Folder

For a server using Plesk add the following lines to a .htaccess file to stop execution of PHP scripts in the folder:

I like to use this to protect cache and image upload folders that are writable by the web server but should not be able to execute code.

As a further precaution, chown the .htaccess to root, so it can’t be overwritten by Apache or FTP, and “chattr +i” to be sure about it.

Have a project or a problem?

Talk with a senior engineer for practical recommendations—no obligation.

Leave a comment

One Response

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts

Categories

Get a free consultation from Reliable Penguin

Submit the form—or for immediate service call 866-649-7984.