0

.htaccess 文件,所以请多多包涵。我想知道是否有任何方法可以禁止来自特定国家/地区的所有 IP,但只允许来自被禁止国家/地区的一两个 IP 访问该站点。这可能吗 ?提前致谢。

4

1 回答 1

0

http://www.countryipblocks.net/country-blocks/htaccess-deny-format/

要允许某些 ips 使用类似的东西

Order deny, allow
Allow from 1.2.3.4

编辑以澄清将它们放在哪里。

我没有看到使用,<limit>所以我删除了它。

Order deny, allow
#ips from the blocked countries that are are allowed
Allow from YYY.YYY.YYY.YYY


# 'deny'-code from website 
# only copy the lines starting with 'deny'
deny from XXX.XXX.XX.X/XX 
deny from XXX.XXX.XX.X/XX 
deny from XXX.XXX.XX.X/XX 
# lines starting with a hash are comments so can be removed

# all other ips are allowed
于 2012-01-25T12:15:56.267 回答