如何让 htaccess 拒绝访问单个 I.P。在开班?

How to get htaccess to deny acess to a single I.P. on openshift?

我希望 .htaccess 有选择地忽略一些 I.P。地址。 我正在将 .htaccess 文件推送到 http://modeldoc-treaties.rhcloud.com/wiki/extensions/log/ip.txt

我知道正在读取 .htaccess,因为它包含

deny from all

然后我收到消息 "Forbidden"。

但是当我将 .htaccess 文件更改为

deny from <my current I.P from whatsmyip>

那么我不会被拒绝访问。

编辑:根据 shooper 的建议我尝试了(只允许我)

Order Deny,Allow
deny from all
allow from <my.ip>

这阻止了我,也(拒绝了我)

Order Allow,Deny
allow from all
deny fro <my.ip>

这允许我。所以我想问题是我不知道我的 i.p 是什么。实际上是一旦它在 openshift 上被转发。

我认为您可能需要 "Order" 指令,如 http://httpd.apache.org/docs/2.2/howto/access.html 所示。

   Order deny,allow
   Deny from <your current I.P. address>
   Allow from all

OpenShift 在您的应用程序前面有一个反向代理,因此显示给您的 .htaccess 文件的 ip 不是用户的真实 ip,它存储在 x-forwarded-for header 中。