如何只允许在国家访问 [英] How to allow access only within country
本文介绍了如何只允许在国家访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我发现本网站生成的.htaccess阻止来自某些国家的访问。
I found this web site to generate a .htaccess to block an access from certain country.
这里的问题是,我想只允许在挪威的访问。如果我用这个服务,名单会很长,因为我必须列出所有国家的IP地址。
The problem with this is that I want to allow access only within Norway. If I use this service, the list will be very long since I have to list all the country IP addresses.
有没有办法,让内对国家的访问,我的情况是挪威?
Is there any way to allow access within country, my case is Norway?
推荐答案
更改拒绝,让所有的实例,并允许所有出现的否认。然后将'拒绝来自所有'状态结束时到列表的开头。
Change all occurences of 'deny' to allow, and all occurrences of 'allow' to deny. Then move the 'deny from all' condition at the end to the beginning of the list.
如:
<Limit GET HEAD POST>
order allow,deny
deny from 41.205.32.0/19
deny from ....
allow from all
</LIMIT>
变为
<Limit GET HEAD POST>
order deny,allow
deny from all
allow from 41.205.32.0/19
allow from ....
</LIMIT>
这里也有一些很好的教程有关的.htaccess 。
这篇关于如何只允许在国家访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文