Sometimes you need to disable execution of scripts under certain folder using .htaccess. It’s useful if you have any security issue on server and want to stop execution of dynamic languages or disable php in images folder under joomla.
Here is the code:
AddHandler cgi-script .php .pl .py .jsp .asp .htm .shtml .sh .cgi
As we can see, we add cgi-script handler to “.php .pl .py .jsp .asp .htm .shtml .sh .cgi” on the first line and on the second we disable the execution of cgi-script as an Option of apache.
That worked for me, when my server had a PHP shell under /media/ folder, hope it’ll help you too!