SEO爱站网 logo SEO爱站网

seo网站推广:新手建站不可不知的robots.txt文件

优化入门 697 0 2019-09-14 23:30:41

robots.txt是搜索引擎蜘蛛爬你站点的时候第一个查看的文件,这个文件是告诉搜索引擎的蜘蛛程序,你的站点上哪些文件给看,哪些不给看。现在主流的搜索引擎还是遵守这一规定,合肥SEO就有深刻体会,本站是20号晚上11点左右解禁robots.txt文件允许搜索引擎蜘蛛访问,21号早上一查百度居然收了,第二天谷歌也收了。

说远了,言归正传。robots.txt是一个文本文件,它必须命名为“robots.txt”并上传到站点根目录下,上传到子目录里是无效的,因为搜索引擎漫游器只会在你的域名根目录中查找这个文件。还是那句话,基础性知识合肥SEO没有实力也没必要在这浪费大家的时间,可以去百度搜索帮助中心和谷歌中文管理员博客看,在这是主要从SEO角度来介绍robots.txt在对网站优化过程中的作用。

一、利于网站优化的robots.txt使用技巧

1、在线建站提供方便之路。当我们将域名解析到服务器,可以访问站点了,可是这个时候站点还没有布局好,meta标签还一塌糊涂。乳沟此时的站点被搜索引擎蜘蛛抓取收录了,到时再更改就很不利于SEO优化。这时就可以利用robots.txt文件来设置所有搜索引擎蜘蛛不允许查询站点的所有内容。其语法格式为:

User-agent: *
Disallow: / 

2、定制搜索引擎蜘蛛抓取指定内容,能让你根据站点情况来选择怎样和搜索引擎打交道。这里有两层意思。

(1)定制搜索引擎。如果你不屑度娘的所作所为的话,可以这样子让它只能对你吹胡子瞪眼。其语法格式为:

User-agent: baiduspider
Disallow: /

注:常见的搜索引擎机器人名称。

名称                                              搜索引擎
Baiduspider                               http://www.baidu.com
Scooter                                       http://www.altavista.com
ia_archiver                                 http://www.alexa.com
Googlebot                                  http://www.google.com
FAST-WebCrawler                   http://www.alltheweb.com
Slurp                                           http://www.inktomi.com
MSNBOT                                    http://search.msn.com

(2)定制站点内容。也就是说你可以指定某个目录允许spider爬行,某个目录禁止spider爬行。如所有搜索引擎蜘蛛,允许抓取目录abc下的内容,禁止抓取目录def下的内容,其语法格式为:

User-agent: * 
Allow: /abc/
Disallow: /def/

3、引导搜索引擎抓取网站内容。这里最典型的做法有

(1)引导蜘蛛抓取你的网站地图。其语法格式为:

 User-agent: * 
 sitemap:sitemap-url

(2)防止蜘蛛抓取你的网站重复内容。

4、404错误页面问题。如果你的服务器自定应了404错误页面而在你站点根目录没有配置robots.txt文件,那么搜索引擎蜘蛛会将其视为robots.txt文件,这将影响搜索引擎对你网站页面的收录。

二、特定程序建站robots.txt的写法。这里只是提供通用的,具体的情况自己斟酌哦。

1、DedeCMS建站的robots.txt文件写法

User-agent: *
Disallow: /plus/feedback_js.php
Disallow: /plus/feedback.php
Disallow: /plus/mytag_js.php
Disallow: /plus/rss.php
Disallow: /plus/search.php
Disallow: /plus/recommend.php
Disallow: /plus/stow.php
Disallow: /plus/count.php
Disallow: /include
Disallow: /templets
Disallow: /member

2、WordPress建站的robots.txt文件写法

User-agent: *
Disallow: /wp-admin
Disallow: /wp-content/plugins
Disallow: /wp-content/themes
Disallow: /wp-includes
Disallow: /?s=
Sitemap: http://www.***.com/sitemap.xml

3、phpcms建站的robots.txt文件写法

User-agent: *
Disallow: /admin
Disallow: /data
Disallow: /templates
Disallow: /include
Disallow: /languages
Disallow: /api
Disallow: /fckeditor
Disallow: /install
Disallow: /count.php
Disallow: /comment
Disallow: /guestbook
Disallow: /announce
Disallow: /member
Disallow: /message
Disallow: /spider
Disallow: /yp
Disallow: /vote
Disallow: /video

4、discuz论坛的robots.txt文件写法

User-agent: * 
Allow: /redirect.php 
Allow: /viewthread.php 
Allow: /forumdisplay.php 
Disallow: /? 
Disallow: /*.php

虽然话题很陈旧,可是需要学习的内容还是很多的。有人说设置robots.txt文件会带来被“有心人”攻击的危险,作为草根的前锋来说无所畏惧了,既然是“有心人”了你也没辙(这不只是建站程序本身,还有服务器安全等等等等)。来自合肥seo: http://www.anhuiseo.org 转载请注明出处。

转载请注明:SEO爱站网 » seo网站推广:新手建站不可不知的robots.txt文件

网友跟帖
展开