【robots.txt怎么写】Robots.txt写法和放在哪里详解


  1、什么是Robots,熟练掌握Robots的基础语法,写出你对本节课的理解


  Robots是指网站与搜索引擎之间的协议,下列三小点是需要自己记住的:


  1.Robots是存放在网站根目录


  2.Robots.txt是放在网站根目录


  3.robots.txt文件名是不可修改的


  4.Robots也是百度蜘蛛第一先抓取的


  2、robots形式及定义:


  User-agent:Baiduspider(定义所有的百度蜘蛛)


  Disallow:/


  User-agent:定义所有的蜘蛛


  Baiduspider:百度蜘蛛


  Googlebot:谷歌机器人


  MSNBot:msn机器


  Baiduspider-image:百度图片


  Disallow:定义那些文件可以抓取,那些文件不可以抓取


  Allow:允许


  小结:网站优化必须要有robots,robots格式区分大小的,区分大小写格式为:Disallow首字母必须是大写的,在本地新建记事本编辑时需要注意的是:输入法中文要切换成英文,例如:


  同时需要注意的是:在编辑时Disallow:/要空一格如下图所示


  *:定义所有的蜘蛛通配符


  /:通配符拒绝百度蜘蛛访问访问网站根目录的文件,就是全部的意思


  Robots生效时间是多少,是由百度决定的,有可能是1个月或者2个月


  附注:放行也是需要生效时间的


  $:结束符


  附注:同时也需要注意的是,网站动态的路径也要用robots进行屏蔽,在这个前提需要做的是,要了解每个文件下的数据是用来做什么用的,代表什么意思,自己下面也知道如何运用robots进行操作。对robots还是不能理解的,可以点击我的博客:


  <divclass="blockcode"><blockquote><ahref="http://bbs.moonseo.cn">SEO研究中心之robots的制作和特殊符号含义</a>


  复制代码


  。


  备注:


  Disallow:/data(一个是文件夹、一个是目录)禁止以data开头的文件或文件夹/data.html/dataaaa.html/data/aaa.html根目录下的文件是不能访问的


  Disallow:/data/(拒绝目录的)禁止文件夹/data/aaa.html能访问/data.html/dataaaa.html


  2、为你在基础操作的网站加上robots


  User-agent:*(定义所有的蜘蛛)


  Disallow:/plus/ad_js.php(拒绝目录/plus/能访问ad_js.php)


  Disallow:/plus/advancedsearch.php


  Disallow:/plus/car.php


  Disallow:/plus/carbuyaction.php


  Disallow:/plus/shops_buyaction.php


  Disallow:/plus/erraddsave.php


  Disallow:/plus/posttocar.php


  Disallow:/plus/disdls.php


  Disallow:/plus/feedback_js.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