【问题标题】:Correct Syntax for Robot.txt File?Robot.txt 文件的正确语法?
【发布时间】:2018-01-14 04:04:03
【问题描述】:

下面的内容在我的 Robot.txt 文件中。

如果我希望某个特定的搜索引擎能够访问该站点,但不是一些关键区域,例如管理部分、wp 内容区域和一个不存在的文件夹,那么我的语法是对 google、msn、bing、yahoo、duckduckbot 有以下正确,但禁止其他所有人?

User-agent: Googlebot
Allow: *
Disallow: /wp-admin/*
Disallow: /wp-content/*
Disallow: /docs/*

User-agent: MSNBot
Allow: *
Disallow: /wp-admin/*
Disallow: /wp-content/*
Disallow: /docs/*

User-agent: Bingbot
Allow: *
Disallow: /wp-admin/*
Disallow: /wp-content/*
Disallow: /docs/*

User-agent: Slurp
Allow: *
Disallow: /wp-admin/*
Disallow: /wp-content/*
Disallow: /docs/*

User-agent: DuckDuckBot
Allow: *
Disallow: /wp-admin/*
Disallow: /wp-content/*
Disallow: /docs/*

User-agent: Google (+https://developers.google.com/+/web/snippet/)
Allow: *
Disallow: /wp-admin/*
Disallow: /wp-content/*
Disallow: /docs/*

User-agent: Googlebot-Image/1.0
Allow: *
Disallow: /wp-admin/*
Disallow: /wp-content/*
Disallow: /docs/*

User-agent: Googlebot-Video/1.0
Allow: *
Disallow: /wp-admin/*
Disallow: /wp-content/*
Disallow: /docs/*

User-agent: SAMSUNG-SGH-E250/1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 UP.Browser/6.2.3.3.c.1.101 (GUI) MMP/2.0 (compatible; Googlebot-Mobile/2.1; +http://www.google.com/bot.html)
Allow: *
Disallow: /wp-admin/*
Disallow: /wp-content/*
Disallow: /docs/*

User-agent: Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5X Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.96 Mobile Safari/537.36 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)
Allow: *
Disallow: /wp-admin/*
Disallow: /wp-content/*
Disallow: /docs/*

User-agent: *
Disallow: *

【问题讨论】:

    标签: wordpress search robots.txt


    【解决方案1】:

    语法正确,但方法错误。

    1.永远不要屏蔽您的内容

    Google(和许多其他搜索引擎)完全呈现您的页面。如果您阻止对图像的访问,Google 会在搜索结果中下拉您的位置,仅针对一个案例。 Googlebot 无法理解您的网页是否包含损坏的图片链接。

    这是来自Maile Ohyequote,Google 开发者计划技术主管:

    “我们建议确保 Googlebot 可以访问任何对您网站的可见内容或其布局有意义的嵌入式资源”

    2。不要阻止 /wp-admin/admin-ajax.php

    当您完全阻止对 /wp-admin/ 的访问时,机器人将没有可用的 ajax 内容。这就是为什么 WordPress 动态生成的标准 robots.txt 如下:

    User-agent: *
    Disallow: /wp-admin/
    Allow: /wp-admin/admin-ajax.php
    

    3.不要阻止其他机器人

    搜索机器人列表比您的问题中显示的要宽,并且偶尔会增加。例如,在您的列表中,Googlebot-Mobile 不存在。您文件中的最后一条语句阻止访问此机器人,并为移动搜索提供明显的结果。

    最好不要发明自行车,而是使用上面显示的标准 WordPress robots.txt 设置,甚至使用Yoast SEO pluginwider settings(安装量超过百万)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-11-19
      • 1970-01-01
      • 1970-01-01
      • 2020-11-22
      • 2013-06-11
      • 1970-01-01
      • 1970-01-01
      • 2016-02-24
      相关资源
      最近更新 更多