当前位置:网站首页>block yandex bot
block yandex bot
2022-07-13 17:14:00 【oHuangBing】
yandex bot 是 Yandex 搜索引擎的爬虫。在 yandex bot user agent 这篇文章中,我总结了所有 yandexbot 的 User-agent,通过那篇文章,我们可以看出有些 Yandexbot 遵守 robots.txt 协议 ,有些不遵守 robots.txt 协议。
我们需要屏蔽 yandexbot(block yandex bot) 可以通过 robots.txt 和 IP 的方式屏蔽,下面分别来讲。
通过 robots.txt 屏蔽 yandexbot
yandex bot user agent 这篇文章中只有遵守 robots.txt 协议的爬虫我们才能通过 robots.txt 协议来屏蔽,如果不遵守我们就没办法通过 robots.txt 协议来屏蔽。
例如,我们需要屏蔽 YandexBot/3.0 这个爬虫,robots.txt 写法如下:
User-agent: YandexBot
Disallow: /
这样就禁止了所有的 YandexBot 抓取我们网站的任何页面,达到了封锁 yandex bot(block yandex bot) 的目的。
如果我们只是想部分页面不被 YandexBot 抓取,我们可以这样写:
User-agent: Yandex
Allow: /
Disallow: /private/user-info
我们允许 YandexBot 访问所有页面,但是最后一条禁止访问 /private/user-info 页面,这样就达到了我们的目的。
还有一些 Yandex bot 并不遵守 robots.txt 协议,所以我们就需要通过 IP 或者 IP 地址段来屏蔽了。
通过 IP 地址来屏蔽 Yandex bot
我们通过 YandexBot 页面可以查询出具体 Yandex bot 的 IP 地址,例如:YandexMobileBot/3.0 并不遵守 robots.txt 协议,所以我们需要通过屏蔽 IP 的方式屏蔽 Yandex bot,通过这个页面显示的 IP ,我们随便选择一个 IP 作为示例:95.108.213.6。
如果我们前端服务器(例如:Nginx,Apache)运行的是 Linux 我们可以直接输入以下命令屏蔽 Yandex bot:
sudo iptables -A INPUT -s 95.108.213.6 -j DROP
这样 YandexMobileBot/3.0 就无法抓取我们网站上的内容了。
我们可以一条一条的输入 IP 地址,通过防火墙来屏蔽。
总结
屏蔽 Yandex bot 我们使用了两种方法,一种是:通过 robots.txt 来屏蔽,还有一种是:通过 IP 地址来屏蔽,如果 Yandexbot 不遵守 rotbots.txt 协议,我们就用 IP 地址来屏蔽。
Yandex bot 是 Yandex 搜索引擎的爬虫,如果我们屏蔽了,可能会给我们带来流量上的损失,请大家考虑好是否一定要屏蔽 Yandex Bot,再做决定。
边栏推荐
- 一篇文章带你了解国企程序员(超详细)
- Summary of wechat applet test points
- 信息系统项目管理师必背核心考点(四十一)风险管理计划
- 看看谷歌如何在目标检测任务使用预训练权值 | CVPR 2022
- MySQL查询报错 [Err] 1046 - No database selected
- Random类生成随机数详解
- 系统总出故障怎么办,或许你该学学稳定性建设!
- Definition, development, application and Prospect of digital transformation
- QT project summary record
- Technology sharing | common proxy tools for interface testing
猜你喜欢

fiddler和charles拦截并修改请求和返回值

一个描述机器学习对温室气体排放影响的系统框架

开鸿智谷 Niobe 407 正式并入OpenHarmony代码主干

自定义类型详解(结构体、枚举,联合)

2018-cvpr-Gesture Recognition: Focus on the Hands

c语言编译器介绍

明解C语言第三章习题

Is the sub database and sub table really suitable for your system? Talk about how to select sub databases, sub tables and newsql

How to deal with the five obstacles of teamwork

Comment écrire des tests d'interface efficaces?
随机推荐
Continous Gesture Recognition with hand-orented spatiotemporal feature
Project management in the eyes of software testers
安装pycharm
电脑桌面图标有小黄锁怎么办?
flow_x+flow_y---RGB
Mindjet MindManager adding image labels
提示您与该网站的连接不是私密连接怎么办?
pytorch提取某一层的特征图
PyTorch - Dropout: A Simple Way to Prevent Neural Networks from Overfitting
The idea of making parent column template with multiple sub columns in the Torres intensive intelligence portal platform
Software testing tools (this may be the most complete set of testing tools so far)
手势方面论文列表
plantUML使用总结
Digital collections are so hot that young people are running out of them
735. Planetary collision: simple stack simulation application problem
【数字识别】基于知识库实现手写体数字识别附matlab代码
【面试:并发篇12:多线程:线程八锁】
一个描述机器学习对温室气体排放影响的系统框架
[底层原理]Socket 究竟是什么? 为啥网络离不开 Socket?
从矩阵中查找数字是否存在