简体   繁体   English

拒绝并允许 ip 访问 .htaccess

[英]deny and allow ip access .htaccess

Seen lots of info regarding this but can't figure out this scenario.看到了很多关于此的信息,但无法弄清楚这种情况。 I want to deny all uk ips but allow my own uk ip.我想拒绝所有英国 ip,但允许我自己的英国 ip。

I have a big list of deny ip addresses which work fine and deny access, but I want to be able to access the site for obvious reasons!我有一个很大的拒绝 ip 地址列表,它们可以正常工作并拒绝访问,但由于显而易见的原因,我希望能够访问该站点!

Basically I'm creating a site for Irish consumer base and the owner wants to exclude the UK from accessing the site.基本上,我正在为爱尔兰消费者群创建一个站点,所有者希望将英国排除在访问该站点之外。 But I need to access it still.但我仍然需要访问它。

In your .htaccess file put this rule in same manner and write your ip's which are whitelisted in allow from your ip在您的.htaccess文件中,以相同的方式放置此规则并写入您的 ip,这些 ip 在您的 ip 中被列入白名单

<Directory "/">
   order deny,allow
   deny from all
   allow from 127.0.0.1
   allow from 127.0.0.2
</Directory>

Using Require使用要求

<RequireAll>
    Require all granted
    Require not ip 10.252.46.165
</RequireAll>

https://httpd.apache.org/docs/2.4/howto/access.html https://httpd.apache.org/docs/2.4/howto/access.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM