我注意到当我向我的robots.txt
佩奇,我用crawl delay: 10
添加到其中的行。我仔细检查了文件,但它没有那一行,为什么会出现?这可能是一些插件的奇怪行为吗?
在我的robots.txt中添加了不需要的“Crawl Delay:10”行
2 个回复
最合适的回答,由SO网友:LordSilver 整理而成
对于那些将WordPress用作其站点CMS的用户,只需删除机器人即可绕过web托管服务器规则。txt文件,并修改WordPress生成的虚拟文件。您只需在函数中添加一个过滤器。主题的php文件。
下面是代码片段:
//* Append directives to the virtual robots.txt
add_filter( \'robots_txt\', \'robots_mod\', 10, 2 );
function robots_mod( $output, $public ) {
$output .= "Disallow: /wp-content/plugins/\\nSitemap: http://www.example.com/sitemap_index.xml";
return $output;
}
您所要做的就是用自己的指令修改$输出。SO网友:Didz
对于我的网站,我也有同样的问题。
这是我的robots.txt
文件(无“爬网延迟:10”)
sitemap: https://baliradar.com/sitemap.xml
User-agent: *
Disallow: /cgi-bin/
Disallow: /wp-admin/
Disallow: /wp-includes/
Disallow: /wp-content/
Disallow: /archives/
Disallow: /wp-*
Disallow: /author
Disallow: /comments/feed/
User-agent: Mediapartners-Google*
Allow: /
User-agent: Googlebot-Image
Allow: /wp-content/uploads/
User-agent: Adsbot-Google
Allow: /
User-agent: Googlebot-Mobile
Allow: /
我已经联系了我的网络主机,他们确认了我的答案结束