如何使用 .htaccess 文件阻止 IP 范围

How to Block an IP range using .htaccess file

我想阻止以下 ips 的访问

https://gyazo.com/f41a53a1a385e41fe669064bff844a3a

我猜在

的范围内

176.123..

那么这行得通吗?

Order Allow,Deny
Deny from 176.123.0.0/16
Allow from all

我还必须将此 htaccess 保存在 public_html 文件夹之外吗?

这应该完成任务

Order Allow,Deny
Deny from 176.123.0.0/16
Allow from all

正如 Eric 所说,这个 ip 范围内的人仍然可以通过代理服务器访问您的网站。

但是如果允许的用户有一个特定的ip范围那么这可以解决

Order Allow,Deny
Deny from all
Allow from *ip range*