测试robots.txt文件变得更轻松
2014年7月17日星期四
作者:
Asaph Arnon, 网站站长工具小组
是否抓取相应网址由robots.txt决定的。
创建并维护正确的robots.txt文件有时并非易事。尽管大多数网站的robots.txt文件创建工作都非常轻松(提示:这些网站通常甚至不需要robots.txt文件!),但是,当robots.txt文件非常大时,要在其中找到当前或以前规定禁止抓取个别网址的指令无异于大海捞针。为了更轻松地进行此项工作,现在我们在网站站长工具中推出了经过改进的
r
obots.txt测试工具
。
您可以在其中查看当前使用的robots.txt文件,并可测试新网址是否已被禁止抓取。为了帮助您厘清复杂的指令,该工具会突出显示促成最终决定的指令。您可以在robots.txt文件中进行更改,并对所做更改进行测试。然后,您只需将文件的新版本上传到服务器,即可使更改生效。您可以在我们的开发者网站上找到
与robots.txt指令以及robots.txt文件处理方式有关的更多内容
。
此外,您还可以查看robots.txt文件的旧版本,并了解访问权限问题何时会导致我们无法抓取网址。例如,如果Googlebot在查找robots.txt文件时遇到500服务器错误,通常会暂停抓取相应网站。
由于您现有的网站可能会出现一些抓取错误或警告,因此我们建议您仔细检查其robots.txt文件。您还可以将该工具与网站站长工具中的其他部分结合使用:例如,您可以使用经过改进的
Google抓取方式工具
来呈现您网站上的重要网页。如果相应工具报告了任何被禁止抓取的网址,您都可以使用该robots.txt测试工具查找文件中规定禁止抓取这些网址的指令,然后改进相应指令。我们经常遇到的一个问题就是因为旧版的robots.txt文件指示禁止抓取CSS、JavaScript或移动内容而导致的 - 您只要看到这样的指令,解决起来通常非常容易。
我们希望这款经过改进的工具能够让您更轻松地测试和维护robots.txt文件。如果您有任何问题,或者您需要一些帮助来编写出色的指令,请随时访问
网站站长帮助论坛
!
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2014-07-01。
[null,null,["最后更新时间 (UTC):2014-07-01。"],[[["Google has updated the robots.txt testing tool in Webmaster Tools to make it easier to identify and fix crawl issues."],["The tool allows users to test new and existing URLs, review robots.txt file history, and pinpoint problematic rules blocking Googlebot access."],["Google recommends reviewing robots.txt files for potential errors, especially for older files that might unintentionally block essential resources like CSS or JavaScript."],["Using the robots.txt testing tool alongside other Webmaster Tools features, like \"Fetch as Google,\" can provide a comprehensive approach to website crawl optimization."],["Google provides resources like their developer site and webmaster help forum for further assistance and guidance with robots.txt files."]]],["An updated robots.txt testing tool is now available in Webmaster Tools, under the Crawl section. This tool allows users to test URLs against their robots.txt file, highlighting the specific rule affecting crawlability. Users can also modify and test changes before uploading the updated file. The tool also reviews older file versions and identifies access issues, such as `500` server errors. It's advised to check for errors and combine with other Webmaster Tools to resolve any blocking rules.\n"]]