# ==========================================================================
# Storage Directory -- Disable PHP Execution & Directory Listing
# ==========================================================================

Options -Indexes -ExecCGI

# Block PHP execution in storage directories
<FilesMatch "\.php$">
    <IfModule mod_authz_core.c>
        Require all denied
    </IfModule>
    <IfModule !mod_authz_core.c>
        Order allow,deny
        Deny from all
    </IfModule>
</FilesMatch>

# Remove PHP handler for uploaded files
RemoveHandler .php .phtml .php3 .php4 .php5 .php7 .phps
AddType text/plain .php .phtml .php3 .php4 .php5 .php7 .phps

# Block sensitive file types
<FilesMatch "\.(sql|log|lock|sh|bak)$">
    <IfModule mod_authz_core.c>
        Require all denied
    </IfModule>
    <IfModule !mod_authz_core.c>
        Order allow,deny
        Deny from all
    </IfModule>
</FilesMatch>
