User-agent: * 这里的*代表的所有的搜索引擎种类,*是一个通配符
Disallow: /admin/ 这里定义是禁止爬寻admin目录下面的目录
Disallow: /require/ 这里定义是禁止爬寻require目录下面的目录
Disallow: /ABC/ 这里定义是禁止爬寻ABC目录下面的目录
Disallow: /cgi-bin/*.htm 禁止访问/cgi-bin/目录下的所有以".htm"为后缀的URL(包含子目录)。
Disallow: /*?* 禁止访问网站中所有的动态页面
Disallow: /.jpg$ 禁止抓取网页所有的.jpg格式的图片
Disallow:/ab/adc.html 禁止爬取ab文件夹下面的adc.html文件。
Allow: /cgi-bin/ 这里定义是允许爬寻cgi-bin目录下面的目录
Allow: /tmp 这里定义是允许爬寻tmp的整个目录
Allow: .htm$ 仅允许访问以".htm"为后缀的URL。
Allow: .gif$ 允许抓取网页和gif格式图片
Allow: 定义允许搜索引擎收录的地址
我们常用的搜索引擎类型有: (User-agent区分大小写)
google蜘蛛:Googlebot
百度蜘蛛:Baiduspider
yahoo蜘蛛:Yahoo!slurp
alexa蜘蛛:ia_archiver
bing蜘蛛:MSNbot
altavista蜘蛛:scooter
lycos蜘蛛:lycos_spider_(t-rex)
alltheweb蜘蛛:fast-webcrawler
inktomi蜘蛛: slurp
Soso蜘蛛:Sosospider
Google Adsense蜘蛛:Mediapartners-Google
有道蜘蛛:YodaoBotrobots.txt文件的写法
1.User-agent: * //禁止所有搜索引擎搜目录1、目录2、目录3
Disallow: /目录名1/
Disallow: /目录名2/
Disallow: /目录名3/
2. User-agent: Baiduspider //禁止百度搜索secret目录下的内容
Disallow: /secret/
3. User-agent: * //禁止所有搜索引擎搜索cgi目录,但是允许slurp搜索所有
Disallow: /cgi/
User-agent: slurp
Disallow:
4. User-agent: * //禁止所有搜索引擎搜索haha目录,但是允许搜索haha目录下test目录
Disallow: /haha/
Allow:/haha/test/
![]() |