Htaccess - 限制对文件的访问,但仅限于当前目录

时间:2015-07-06 08:42:56

标签: .htaccess

我有index.php文件,我想只允许访问特定的ip with htaccess。

但是我想允许所有人访问子目录中名为index.php的文件。

我应该如何编写仅影响当前目录中index.php的规则?这是我尝试但没有成功,它也阻止了子目录中的index.php:

 <Files "./index.php">
        Order deny,allow
        Deny from all
        Allow from 192.168.24.2
    </Files>

1 个答案:

答案 0 :(得分:0)

您可以在子目录中编写一个.htaccess,其中包含Allow from all,从而允许访问这些特定目录及其子目录。

相关问题