的.htaccess:如何通过IP限制访问一个文件?文件、htaccess、IP

2023-09-02 09:37:12 作者:绣花针针恨

我已经看遍,但仍然保持运行到该谈目录级IP限制,通常看起来像这样相同的信息:

I've look all over, but keeps running into same info that talks about directory level IP restriction, which usually looks something like this:

Order Deny,Allow
Deny from all
Allow from 123.123.123.123

时有可能有相同的类型依赖于一个网页/文件访问限制的?

Is it possible to have same type of access restriction tied to a page/document?

推荐答案

这将使无论是有人从IP 127.0.0.1的或的记录为有效用户。坚持下去,无论是在你的配置或.htaccess文件。

This will allow either someone from IP 127.0.0.1 or logged as a valid user. Stick it either in your config or .htaccess file.

    <Files learn.php>
        Satisfy any
        Order deny,allow
        Deny from all
        Allow from 127.0.0.1

        AuthType Basic
        AuthName "private"
        AuthUserFile /var/www/phpexperts.pro/.htpasswd
        AuthGroupFile /dev/null
        Require valid-user
    </Files>

IP当家:

IP Alone:

    <Files learn.php>
        Order deny,allow
        Deny from all
        Allow from 127.0.0.1
    </Files>

这肯定回答你的问题。

 
精彩推荐
图片推荐