no comments yet
05 Jan 2015

.htaccess禁止IP访问

这几天在看流量统计时注意到,有几个IP每隔十几分钟就来我的网站上疯狂采集一番,几天终于受够了,决定把它们拉入禁止访问列表。

可以通过.htaccess作用来设置禁止访问的IP和IP段。

Order Allow,Deny
Deny from 92.241.169
Allow from all

.htaccess禁止IP 的话直接某个IP,禁止IP段 的话就是:

Deny from 92.241.169。(92.241.169.1-92.241.169.254)

效果就是访问显示:

Forbidden You don't have permission to access / on this server.

Additionally, a 403 Forbidden error was encountered while trying to
use an ErrorDocument to handle the request.