# 上传目录：只许出内容，不许执行代码。
# 有人传个 shell.php 进来，这里就是最后一道门。

<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>

RemoveHandler .php .phtml .php3 .php4 .php5 .php7 .phar .cgi .pl .py
RemoveType .php .phtml .php3 .php4 .php5 .php7 .phar
Options -ExecCGI -Indexes

<FilesMatch "\.(php|phtml|php3|php4|php5|php7|phar|cgi|pl|py|sh|htaccess)$">
  Require all denied
</FilesMatch>

# 强制下载，防止浏览器把用户上传的 HTML/SVG 当页面渲染（存储型 XSS）
<FilesMatch "\.(html|htm|xhtml|svg|xml)$">
  ForceType text/plain
  Header set Content-Disposition "attachment"
</FilesMatch>
