1

問題は、ここで robots.txt ファイルを確認できることです。

http://persian.cc

(ドメイン名の後に /robots.txt を付けてください)

しかし、グーグルはできません!

ウェブサイトのルートに robots.txt ファイルがあることは知っていますが、私のサイトには robots.txt ファイルはなく、この robots.txt は WordPress によって作成された仮想ファイルです。wordpressでそれをやめるにはどうすればいいですか?

または、その仮想 robots.txt ファイルを表示する wordpress を停止できない場合、Google が自分の Web サイトでそのファイルを探すのを停止するにはどうすればよいですか? たぶん.htaccessコードか何か?

ありがとう

4

1 に答える 1

1

これが役立つかどうかはわかりません。しかし、WordPres / Joomla / PHPBB の robots.txt に関する記事を維持することを約束しました。それはまだ動作状態にあります。ここにあります:

http://mast3rpee.tk/?p=127

基本的に私がやっていることは、デフォルトの robot.txt を設定し、.haccess ファイルを使用して apache を変更して、カスタム robots.php を強制的にロードすることです。なんで?これは、ここにある問題だけでなく、ほとんどの問題を解決します。また、あらゆる種類の問題を引き起こす可能性のある無料のホスティングでも機能します (一部の txt ファイルを禁止したり、robots.txt を上書きしたりするものもあります)。

コードはこちら

.htaccess

# BEGIN Robots
<IfModule mod_rewrite.c>
<FilesMatch "^robots.(txt|php)$">
Header Set Last-Modified "Tue, 01 Jan 2013 12:00:00 GMT"
</FilesMatch>
RewriteEngine On
RewriteBase /
RewriteRule ^(robots)\.txt$ /$1.php [L]
</IfModule>
# END Robots

robots.txt

User-agent: *
Disallow: /cgi-bin/
Disallow: /feed/
Disallow: /wp-admin/
Disallow: /wp-content/plugins/
Sitemap: http://{PUT YOUR DOMAIN}/sitemap.xml
Crawl-delay: 4

robots.php

<?php
$start = "2013/01/01";  // Date you started your blog YYYY/MM/DD
$average = 30;      // Number of posts you make per month
$sitemap = "http://{PUT YOUR DOMAIN}/sitemap.xml";
// Is blog old enough
$old = ($average/30)*(time()-strtotime($start)) > 3600*24*360? true : false;
// Output proper headers
header ('Content-Type: text/plain');
header ('Cache-Control: private, pre-check=0, post-check=0, max-age=36000');
header ('Expires: ' . gmstrftime('%a, %d %b %Y %H:%M:%S GMT', time() + 36000));
header ('Last-Modified: ' . gmstrftime('%a, %d %b %Y %H:%M:%S GMT', time() - 36000));

if ($old) { $custom = date("Y/m");
echo <<< ROBOTS
User-agent: *
Disallow: /cgi-bin/
Disallow: /feed/
Disallow: /wp-admin/
Disallow: /wp-content/plugins/
Disallow: /$custom
Sitemap: $sitemap
Crawl-delay: 4
ROBOTS;
} else { $custom = date("Y");
echo <<< ROBOTS
User-agent: *
Disallow: /cgi-bin/
Disallow: /feed/
Disallow: /wp-admin/
Disallow: /wp-content/plugins/
Disallow: /archives/
Disallow: /tag/
Disallow: /$custom
Sitemap: $sitemap
Crawl-delay: 4
ROBOTS;
}
exit; ?>
于 2013-06-10T17:27:35.383 に答える