为什么 Allow 配合 meta noindex 比使用Disallow好?

为什么 Allow 配合 meta noindex

1、Disallow 的问题

当你使用 Disallow: / 时:

  • 爬虫根本不会访问你的页面

  • 因此永远看不到你的 meta noindex 标签

  • 如果有其他网站链接到你的页面,Google 可能还是会将其编入索引(因为它无法确认你是否真的不想被索引)

robots.ts

// 这种方式不太理想
res.send(
  `User-agent: *
Disallow: /  # 爬虫被挡在门外,看不到 meta 标签
`
);

2、Allow 的优势

当你使用 Allow: / 时:

  • 爬虫可以访问你的页面

  • 可以看到并理解meta noindex 标签

  • Google 会明确知道你不想被索引,而不是猜测

  • 更容易从搜索结果中移除已经被索引的页面

// 这是推荐的方式
res.send(
  `User-agent: *
Allow: /  # 让爬虫进来,这样它能看到 meta noindex
`
);

比喻说明

可以把这个过程想象成:

  • Disallow 就像关上门不让客人进来

  • Allow + meta noindex 就像让客人进来,但明确告诉他们"请不要在外面宣传这个地方"

第二种方式更礼貌也更明确,搜索引擎更可能遵守你的请求。这就是为什么 Allow 配合 meta noindex 的效果反而更好!

HTTP/1.1 200 OK Server: nginx/1.20.2 Date: Sat, 04 Oct 2025 13:56:50 GMT Content-Type: text/html Content-Length: 3485 Last-Modified: Thu, 25 Sep 2025 08:34:48 GMT Connection: close ETag: "68d4fea8-d9d" Access-Control-Allow-Origin: * Access-Control-Allow-Credentials: true Access-Control-Allow-Methods: GET, PUT, POST, DELETE, OPTIONS Access-Control-Allow-Headers: Content-Type,* Accept-Ranges: bytes <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> <meta name="renderer" content="webkit" /> <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" /> <meta name="description" content="中国历史最悠久的IP地理位置库,纯真IP库,免费IP库,开源IP库,全球IP地址库,IP地址,IP定位" /> <meta name="keywords" content="纯真,纯真IP库,cz88,IP查询,查IP,IP定位,IP精确定位,IP精准定位,高精度IP定位,高精度IP地址查询, IP地理位置,IP地址查询,IP地址定位,IPv4库,IPv6库,全球IP库,全球IP地址数据库,全球IP地理位置数据库,IP实验室,IP实验室APP" /> <meta http-equiv="Access-Control-Allow-Origin" content="*"> <link rel="icon" href="/favicon.ico"> <title>纯真网络,中国历史最悠久的IP地理位置库</title> <script type="text/javascript" src="https://api.map.baidu.com/api?v=3.0&ak=CkwUbXmRHOiPMuspd3qoB8Duw54LHjld"></script> <script type="text/javascript" src="/qrcode.min.js"></script> <script type="text/javascript" src="/jquery-3.6.4.min.js"></script> <link rel="shortcut icon" type="text/css" href="./favicon.ico"> <link rel="apple-touch-icon" href="./favicon.ico"> <script async> var _hmt = _hmt || []; (function () { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?5fe556ebe1c9d856695a9a35f4d18ce3"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })(); </script> <script async type="text/javascript"> window._agl = window._agl || []; (function () { _agl.push( ['production', '_f7L2XwGXjyszb4d1e2oxPybgD'] ); (function () { var agl = document.createElement('script'); agl.type = 'text/javascript'; agl.async = true; agl.src = 'https://fxgate.baidu.com/angelia/fcagl.js?production=_f7L2XwGXjyszb4d1e2oxPybgD'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(agl, s); })(); })(); </script> <script async src="https://www.googletagmanager.com/gtag/js?id=G-SGEY66BFK5"></script> <script async> window.dataLayer = window.dataLayer || []; function gtag() { dataLayer.push(arguments); } gtag('js', new Date()); gtag('config', 'G-SGEY66BFK5'); </script> <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-6889722632622179" crossorigin="anonymous"></script> <script> // window['addAds'] = function(){ // let childList = document.getElementsByClassName('gads'); // for(let i = 0;i < childList.length;i ++){ // (adsbygoogle = window.adsbygoogle || []).push({}); // } // } </script> <script type="module" crossorigin src="/assets/index-Zwxh6Ari.js"></script> <link rel="stylesheet" crossorigin href="/assets/index-LJt8WUfj.css"> </head> <body style=" width: 100%;background: #091543;padding: 0px;margin: 0px;"> <div id="app"></div> </body> </html> 这是上述ctf赛题经过HTTPS重定向后的内容,结合上述信息分析一下
10-05
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值