的.htaccess:如何通过IP限制访问一个文件? [英] .htaccess: how to restrict access to a single file by IP?

查看:209
本文介绍了的.htaccess:如何通过IP限制访问一个文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经看遍,但仍然保持运行到该谈目录级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>

这肯定回答你的问题。

这篇关于的.htaccess:如何通过IP限制访问一个文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆