参考资料

  1. robots.txt利用
  2. Meta Robots 详解
  3. robots.txt sitemap
  4. robots.txt 生成
  5. robots.txt disallow
  6. Bing 管理员工具
  7. robots.txt 参数设置
  8. robots.txt 文件详细说明

robots.txt 文件用于指示网络爬虫(如搜索引擎的爬虫)如何访问网站的页面。其基本语法如下:

  1. User-agent: 指定爬虫的名称。* 表示所有爬虫。

    User-agent: *
  2. Disallow: 禁止爬虫访问的路径。

    Disallow: /private/
  3. Allow: 允许爬虫访问的路径(通常与 Disallow 结合使用)。

    Allow: /public/
  4. Sitemap: 指定网站地图的位置。

    Sitemap: https://example.com/sitemap.xml

示例:

User-agent: *
Disallow: /private/
Allow: /public/
Sitemap: https://example.com/sitemap.xml