# === CHẶN THỰC THI PHP/SCRIPT TRONG THƯ MỤC UPLOADS ===
# Ngăn webshell: kể cả attacker upload được file .php, nó sẽ không chạy được

# Tắt directory listing và CGI
Options -Indexes -ExecCGI

# Tắt handler PHP (hoạt động với cả mod_php và FastCGI)
RemoveHandler .php .phtml .php5 .php7 .pht .phps
RemoveType .php .phtml .php5 .php7 .pht .phps

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

# Chặn thực thi mọi file script
<FilesMatch "\.(php|php5|php7|phtml|pht|phps|cgi|pl|py|sh|bash|asp|aspx|jsp|exe|com|bat|cmd|vbs|ws|wsf|shtml)$">
    Require all denied
</FilesMatch>

# Chặn file có double extension (shell.php.jpg, hack.phtml.png)
<FilesMatch "\.(php|phtml|pht|php5|php7)\.\w+$">
    Require all denied
</FilesMatch>

# Force type ảnh — ngăn browser thực thi script giấu trong ảnh
AddType image/jpeg .jpg .jpeg
AddType image/png .png
AddType image/gif .gif
AddType image/webp .webp
AddType image/x-icon .ico
