# ========================================================
# APPSALAMA - SECURITY HARDENING FOR UPLOADS DIRECTORY
# Disables all script execution inside upload directory
# ========================================================

# Deny execution of PHP and other script files
<FilesMatch "\.(php|phtml|php3|php4|php5|php7|php8|phps|pl|py|cgi|asp|aspx|sh|bash|exe)$">
    <IfModule mod_authz_core.c>
        Require all denied
    </IfModule>
    <IfModule !mod_authz_core.c>
        Order deny,allow
        Deny from all
    </IfModule>
</FilesMatch>

# Disable PHP engine if mod_php is used
<IfModule mod_php.c>
    php_flag engine off
</IfModule>
<IfModule mod_php7.c>
    php_flag engine off
</IfModule>
<IfModule mod_php8.c>
    php_flag engine off
</IfModule>

# Prevent directory indexing
Options -Indexes -ExecCGI
