我在htaccess文件中
<Index "">
<Files "*.php">
Order Reject, Allow
Reject All
</Files>
我给出了
</Directory>
命令,但它给出了内部错误。
请帮忙,为什么会出现这种情况?我不使用 WordPress,我的网站在 VDS 上。
<Directory "C:\xampp\htdocs">
<Files "*.php">
Order Deny,Allow
Deny from All
</Files>
</Directory>
您不能在.htaccess中使用
Directory
指令。
当您检查文档时,https://httpd.apache.org/docs/2.4/mod/core.html#directory,它说:
上下文:服务器配置、虚拟主机
- 这意味着,该指令可以在主服务器配置文件中使用,或者在
VirtualHost
容器中使用 - 但不能在 .htaccess 中使用。
https://httpd.apache.org/docs/2.4/mod/directive-dict.html#Context