【问题标题】:Disallow entire directory for all the search engines from robots.txt file禁止 robots.txt 文件中所有搜索引擎的整个目录
【发布时间】:2014-11-12 17:24:43
【问题描述】:

谁能指导我如何为以下 URL 或目录创建 robots.TXT 文件:

我想在搜索引擎中做索引的原始网址:

book2park.com/
book2park.com/locations.php

但我在 Google 数据库中找到的以下 URL(几乎所有页面)我想永久禁止所有搜索引擎访问:

lawnchair.book2park.com/
lawnchair.book2park.com/locations.php

基本上,“Lawnchair”出现在每个 URL 的开头。

【问题讨论】:

  • 你尝试了什么?你真的想在lawnchair.book2park.com 上只禁止/locations.php,不允许其他网址吗?

标签: robots.txt


【解决方案1】:

给定的 robots.txt 文件仅适用于加载它的确切子域。也就是说,下面的 robots.txt 文件:

http://sub1.example.com/robots.txt

只能控制爬取:

http://sub1.example.com/...

无法控制以下内容的抓取:

http://example.com/...
http://sub2.example.com/...
http://sub.sub1.example.com/...

解决方案是为每个子域添加单独的 robots.txt 文件。所以,在http://lawnchair.book2park.com/robots.txt 你可以屏蔽一切:

User-agent: *
Disallow: /

http://book2park.com/robots.txt 上,您可以允许一切:

User-agent: *
Disallow:

(或者您可能只是在主域上没有 robots.txt 文件)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-04-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多