这是htaccess文件:
ErrorDocument 400 /index.php
ErrorDocument 401 /index.php
ErrorDocument 403 /index.php
ErrorDocument 404 /index.php
ErrorDocument 405 /index.php
<Files configure.php>
order allow,deny
deny from all
</Files>
config.php文件位于某个文件夹中,比如/config/configure.php现在的问题是我可以下载它!只需链接即可。这是因为这行ErrorDocument 404/index.php,当我删除这行时出现404错误,无法下载config.php文件。但为什么会这样这一行(我想要的)可以下载config.php文件吗?
您需要将.htaccess
文件(而不是htaccess
,没有前导点)放入configure.php
所在的文件夹中(至少),以使<Files configure.php>
-指令Docs起作用。请参阅文件系统、Web空间和布尔表达式Docs。
相关:请求.htaccess应该返回404而不是403