如何屏蔽谷歌爬虫抓取某一页面?

以前可以使用Google Search Console网址参数工具,现在被废止了,https://developers.google.com/search/blog/2022/03/url-parameters-tool-deprecated

现在可以使用Robots.txt的配置来屏蔽某一页面,安装插件:Robots.txt Editor

插件安装以后,默认就会给屏蔽一些网址,注意查看有没有错误屏蔽。

安装后,在后台——Setting——Reading这个地方可以看到。

我安装后发现Sitemap是不对的,我更新了一下,添加了屏蔽/wp-admin/

User-Agent: *
Disallow: /cgi-bin
Disallow: /wp-
Disallow: /?s=
Disallow: *&s=
Disallow: /search
Disallow: /author/
Disallow: *?attachment_id=
Disallow: */feed
Disallow: */rss
Disallow: /embed Disallow: /wp-admin/ Allow: /wp-content/uploads/ Allow: /wp-content/themes/ Allow: //.js Allow: //.css Allow: /wp-.png
Allow: /wp-.jpg Allow: /wp-.jpeg
Allow: /wp-.gif Allow: /wp-.svg
Allow: /wp-*.pdf

Sitemap: https://ensky.tech/sitemap_index.xml

使用工具测试屏蔽的网址

工具地址:https://technicalseo.com/tools/robots-txt/

不要使用GSC测试,虽然Robots告知了爬虫不要爬/feed/,但爬虫可能还会爬,GSC并不会报错。

使用URL Inspection检查一下就可以了

学习资料:

谷歌讲解Robots.txt: https://developers.google.com/search/docs/advanced/robots/robots_txt