# Uploads directory: serve ONLY image files, never execute anything.
# Compatible with common cPanel Apache + PHP-FPM setups:
#  - php_admin_flag was removed (server-config-only directive; it causes a
#    500 error in .htaccess on many PHP-FPM/suPHP hosts).
#  - Execution is prevented three ways: default-deny on everything that is
#    not an image, script handlers/types removed, and a static handler forced.

# 1) Default-deny EVERYTHING in this directory
<IfModule mod_authz_core.c>
  Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
  Order allow,deny
  Deny from all
</IfModule>

# 2) Re-allow only known image types
<FilesMatch "\.(jpe?g|png|webp|avif)$">
  <IfModule mod_authz_core.c>
    Require all granted
  </IfModule>
  <IfModule !mod_authz_core.c>
    Order allow,deny
    Allow from all
  </IfModule>
</FilesMatch>

# 3) Belt and braces: even if access rules were bypassed, nothing here may run
<IfModule mod_php.c>
  # Only valid where mod_php is in use; ignored everywhere else.
  php_flag engine off
</IfModule>
RemoveHandler .php .phtml .php3 .php4 .php5 .php7 .php8 .phar .cgi .pl .py .sh
RemoveType .php .phtml .php3 .php4 .php5 .php7 .php8 .phar
<IfModule mod_mime.c>
  SetHandler default-handler
</IfModule>

Options -Indexes -ExecCGI
