【发布时间】:2015-04-14 10:44:41
【问题描述】:
如何使用 .htaccess 阻止 IP 范围 103.4.8.0 - 103.4.15.255?
我的意思是我想阻止
- 103.4.8.0-103.4.8.255
- 103.4.9.0-103.4.9.255
- ..
- 103.4.15.0-103.4.15.255
【问题讨论】:
标签: .htaccess
如何使用 .htaccess 阻止 IP 范围 103.4.8.0 - 103.4.15.255?
我的意思是我想阻止
【问题讨论】:
标签: .htaccess
您可以使用 ip/网络掩码对给出地址范围:
deny from 127.0.55.0/24
但是,由于范围 55 - 75 不是 2 的幂,所以我不知道如何从中得出范围。我会添加几条规则。
order allow,deny
deny from 127.0.55.0/24 // Matches 55
deny from 127.0.56.0/21 // Matches 56 to 64
deny from 127.0.64.0/21 // Matches 64 to 71
deny from 127.0.72.0/22 // Matches 72 to 75
deny from 127.0.235.0/24 // Matches 235
deny from 127.0.236.0/22 // Matches 236 to 239
deny from 127.0.240.0/21 // Matches 240 to 255
allow from all
【讨论】:
我最终使用了:
<Limit GET HEAD POST>
order allow,deny
allow from all
deny from 103.4.8.
deny from 103.4.9.
..
deny from 103.4.15.
</Limit>
【讨论】: