WordPress常用Robots.txt规则


Robots协议(也称为爬虫协议、机器人协议等)的全称是“网络爬虫排除标准”(Robots Exclusion Protocol),网站通过Robots协议告诉搜索引擎哪些页面可以抓取,哪些页面不能抓取。在网站根目录Robots.txt里添加如下规则,参考自知更鸟博客。

User-agent: *
Disallow: /wp-admin/
Disallow: /wp-content/
Disallow: /wp-includes/
Disallow: /*/comment-page-*
Disallow: /*?replytocom=*
Disallow: /category/*/page/
Disallow: /tag/*/page/
Disallow: /*/trackback
Disallow: /feed
Disallow: /*/feed
Disallow: /comments/feed
Disallow: /?s=*
Disallow: /*/?s=*\
Disallow: /attachment/

各项的作用:

1、Disallow: /wp-admin/、Disallow: /wp-content/和Disallow: /wp-includes/

用于告诉搜索引擎不要抓取后台程序文件页面。

2、Disallow: /*/comment-page-*和Disallow: /*?replytocom=*

禁止搜索引擎抓取评论分页等相关链接。

3、Disallow: /category/*/page/和Disallow: /tag/*/page/

禁止搜索引擎抓取收录分类和标签的分页。

4、Disallow: /*/trackback

禁止搜索引擎抓取收录trackback等垃圾信息

5、Disallow: /feed、Disallow: /*/feed和Disallow: /comments/feed

禁止搜索引擎抓取收录feed链接,feed只用于订阅本站,与搜索引擎无关。

6、Disallow: /?s=*和Disallow: /*/?s=*\

禁止搜索引擎抓取站内搜索结果

7、Disallow: /attachment/

禁止搜索引擎抓取附件页面,比如毫无意义的图片附件页面。

标签:

文章发布时间:2018-04-23