apache如何禁止网络爬虫采集的配置方法
来源:网络 作者:佚名 点击:
次时间:2017-06-18 20:47
[摘要] 有时我们的网站不希望网络爬虫来采集数据,如果我们的站点是部署在apache下的话,只要配置一下apache的配置文件,就可以禁止网络爬虫来爬了。
Apache中禁止网络爬虫,其实也挺简单的,只要把下面的代码配置到apache的httpd.conf文件中的Location中,就可以了。
<Location />
SetEnvIfNoCase User-Agent "spider" bad_bot
BrowserMatchNoCase bingbot bad_bot
BrowserMatchNoCase Googlebot bad_bot
Order Deny,Allow
#下面是禁止soso的爬虫
Deny from 124.115.4. 124.115.0. 64.69.34.135 216.240.136.125 218.15.197.69 155.69.160.99 58.60.13. 121.14.96. 58.60.14. 58.61.164. 202.108.7.209
Deny from env=bad_bot
</Location>
这是禁止了所有包含spider字符的爬虫。
如果要针对性的禁止爬虫,改成精确匹配的爬虫字符串,如果bingbot、Googlebot等等
|
------分隔线----------------------------