# Protect uploaded files from direct access
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule \.(php|php[0-9]|phtml|pl|py|jsp|asp|aspx|cgi|sh|bash)$ - [F,L,NC]
</IfModule>

# Deny access to .htaccess itself
<Files .htaccess>
    Order allow,deny
    Deny from all
</Files>

# Disable PHP execution in this directory
<IfModule mod_php.c>
    php_flag engine off
</IfModule>

<IfModule mod_php7.c>
    php_flag engine off
</IfModule>

# Alternative for PHP-FPM
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule .* - [E=PHP_FLAG:off]
</IfModule>
