如何为WordPress设置robots.txt文件

时间:2013-06-10 17:46:50

标签: wordpress robots.txt

[更新2013]

我无法找到具有针对WordPress的robots.txt文件格式的权威页面。我保证会在我的网站上保留一个,但我想在堆栈溢出中找到一个。

如果您知道自己在做什么,请在此处查看当前草稿:

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

其他人对此发表评论:

的robots.txt

User-agent: *
Disallow: /cgi-bin/
Disallow: /wp-admin/
Disallow: /wp-includes/
Disallow: /wp-content/plugins/
Disallow: /wp-content/cache/
Disallow: /wp-content/themes/
Disallow: /trackback/
Disallow: /feed/
Disallow: /comments/
Sitemap: http://domain.com/sitemap.xml
Crawl-delay: 4

4 个答案:

答案 0 :(得分:10)

User-agent: *
Allow: /
Disallow: /cgi-bin
Disallow: /wp-admin
Disallow: /wp-includes
Disallow: /wp-content
Disallow: /e/
Disallow: /show-error-*
Disallow: /xmlrpc.php
Disallow: /trackback/
Disallow: /comment-page-
Allow: /wp-content/uploads/

User-agent: Mediapartners-Google
Allow: /

User-agent: Adsbot-Google
Allow: /

User-agent: Googlebot-Image
Allow: /

User-agent: Googlebot-Mobile
Allow: /

Sitemap: http://yoursite.com/sitemap.xml

我认为此代码对于robots.txt文件非常真实,只需转到Public_HTML并使用robots.txt创建文件并粘贴上面的代码。 你可以在记事本中制作,只需复制上面的代码并粘贴到notpad中,但记住文件名应该是robots.txt并上传到你的public_HTML。

答案 1 :(得分:1)

与所有SEO一样,事情会发生变化。我认为目前的建议是拥有一个非常小的robots.txt文件。

忽略wp-admin,wp-includes,wp-content等可能会阻止Google正确呈现页面,这是不喜欢的。

看看Yoast的这篇文章:https://yoast.com/wordpress-robots-txt-example/

答案 2 :(得分:0)

在记事本robots.txt中创建并将其上传到CPANEL中的public_html。

*请记住将文件记事本重命名为机器人,然后再将其上传到public_html

答案 3 :(得分:0)

现在,robots.txt阻止你的{{1}}单一谷歌尝试加载所有资产以确定“移动友好性”是不安全的。至少你可以阻止/ wp-admin。这是a more detailed, current answer to the question at the StackExchange forum for WordPress