为你的wordpress添加robots.txt

推到 Facebook!
推到 Twitter!
推到 Plurk!

刚才无聊搜索google,发现它收录了一些有的没有的。就是没用的连接。

但我们可以利用robots.txt来限制search engine抓取部分目录及文件。

什么是robots.txt?其实它只是一个放在网站根目录内,并且记了些文字的文本文件罢了。

就是告诉search engine那些东西可以收录,那些不可以。

这样做会提高网页的友善度,这也是seo的其中一个方法。

不然收录好几个网址,但内容一样的网页。这样不太好。

在google找到对应wordpress的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: /wp-content/upgrade
Disallow: /wpau-backup
Disallow: /trackback
Disallow: /comments
Disallow: */trackback
Disallow: */comments
Disallow: /wp-login.php

# disallow all files with ? in url
Disallow: /*?*
Disallow: /*?

Allow: /wp-content/uploads

# allow google image bot to search all images
User-agent: Googlebot-Image
Disallow:
Allow: /*

# Google AdSense
User-agent: Mediapartners-Google*
Disallow:
Allow: /*

User-agent: *
# disallow all files ending with these extensions
Disallow: /*.php$
Disallow: /*.js$
Disallow: /*.inc$
Disallow: /*.css$
Disallow: /*.cgi$
Disallow: /*.xhtml$

# digg mirror
User-agent: duggmirror
Disallow: /

# allow adsense bot on entire site
User-agent: Mediapartners-Google*
Disallow:
Allow: /*

Sitemap: http://diy.001zone.com/sitemap.xml.gz

把以上代码储存成robots.txt ,全部小写。
然后上传到网站根目录。
例如

http://diy.001zone.com

robots.txt就放在

http://diy.001zone.com/robots.txt

Related posts:

  1. 超吊的google
  2. Google推出新服务:Google Public DNS


One Comment

  1. qzfl says:

    正在弄这个,不错!

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>