我的 api 位于 api.website.com,不需要身份验证。
我正在寻找一种方法来禁止 Google 索引我的 API。
有办法吗?
我的机器人中已经禁止了 api.website.com/robots.txt 但这只会阻止谷歌抓取它。
User-agent: *
Disallow: /
通常的方法是删除 Disallow 并添加 noindex 元标记,但它是一个 API,因此没有元标记或任何内容。
还有其他办法吗?
最佳答案
似乎有一种方法可以在 api 调用上添加 noindex。
The solution recommended on both of those pages is to add a noindex meta tag to the pages you don't want indexed. (The X-Robots-Tag HTTP header should also work for non-HTML pages. I'm not sure if it works on redirects, though.) Paradoxically, this means that you have to allow Googlebot to crawl those pages (either by removing them from robots.txt entirely, or by adding a separate, more permissive set of rules for Googlebot), since otherwise it can't see the meta tag in the first place.
关于indexing - 防止搜索引擎索引我的 api,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55463699/