# Disable directory listing and script execution in uploads directory
Options -ExecCGI -Indexes

# Block execution of all scripts
<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>

# Deny direct access to dangerous executable or script files
<FilesMatch "(?i)\.(php|phtml|php3|php4|php5|php7|phar|shtml|cgi|pl|py|sh|bash|html|htm|js|mjs|cjs|jsp|asp|aspx|exe|bat|cmd|vbs|ps1|jar|war)$">
  Require all denied
</FilesMatch>

# Security Headers for uploaded media
<IfModule mod_headers.c>
  Header set X-Content-Type-Options "nosniff"
  Header set Content-Security-Policy "default-src 'none'; sandbox"
</IfModule>
