网站.htacess设置防止访问其他类型的文件

在网站目录设置

# 禁止执行 PHP 文件
<FilesMatch "\.(php|phtml|php3|php4|php5|php7)$">
    Require all denied
</FilesMatch>

# 允许访问图片和其他文件
<FilesMatch "\.(jpg|jpeg|png|gif)$">
    Require all granted
</FilesMatch>

# 开启子目录访问权限
<IfModule mod_autoindex.c>
    Options +Indexes
</IfModule>
posted @ 2025-03-04 03:49  白云&黑土  阅读(13)  评论(0)    收藏  举报