拒绝某IP访问

因为不想某些鼠辈窥探,所以决定屏敝某IP对于网站的访问,还好那人的IP是固定的。

方法如下,修改根目录下的.htaccess文件。在代码后面加上:

# 屏敝IP代码开始
Deny from 202.116.0.248
ErrorDocument 403 http://www.google.cn
#屏敝IP代码结束

代码中的IP202.116.0.248替换成你要禁止访问的IP,后面的网址是被拒IP访问后自动跳转到的页面。

注意的是,IP要精确到每一位。不能用202.116.0.*等IP段来代替。这办法对于电信用户无效。

One thought on “拒绝某IP访问

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">