我正在使用 WordPress。其中一个文件functions.php
包含function do_robots() {...
阻止 Google 抓取的内容。我已将此功能替换为以下内容:
function do_robots() {
header( 'Content-Type: text/plain; charset=utf-8' );
do_action( 'do_robotstxt' );
if ( '0' == get_option( 'blog_public' ) ) {
echo "User-agent: *";
echo "\nDisallow: /wp-admin";
echo "\nDisallow: /wp-includes";
echo "\nDisallow: /wp-content";
echo "\nDisallow: /stylesheets";
echo "\nDisallow: /_db_backups";
echo "\nDisallow: /cgi";
echo "\nDisallow: /store";
echo "\nDisallow: /wp-includes\n";
} else {
echo "User-agent: *";
echo "\nDisallow: /wp-admin";
echo "\nDisallow: /wp-includes";
echo "\nDisallow: /wp-content";
echo "\nDisallow: /stylesheets";
echo "\nDisallow: /_db_backups";
echo "\nDisallow: /cgi";
echo "\nDisallow: /store";
echo "\nDisallow: /wp-includes\n";
}
}
- 我不太确定
Allow
。是不是只要我不Disallow
,就Allow
默认了? - 为什么 Google Bot 仍然被上述内容阻止
function
?