1、概述
①robots.txt純文本文件,網(wǎng)站管理員可以在這里聲明該網(wǎng)站不想robots訪問的部分,所以robots優(yōu)化直接影響著搜索引擎對網(wǎng)站的收錄情況;
②robots.txt必須放置在一個(gè)站點(diǎn)的根目錄下,并且文件名必須全部小寫:www.baidu.com/robots.txt;
③就算你的網(wǎng)站全部內(nèi)容都可以被搜索引擎收錄,那也要寫個(gè)空的robots.txt;因?yàn)橛械姆?wù)器的設(shè)置會(huì)使沒有robots.txt的時(shí)候返回200狀態(tài)碼和相應(yīng)的錯(cuò)誤信息;

2、robots的寫法
# robots.txt file from http://www.registerjl.com
# All robots will spider the domain
User-agent:*
Disallow:
①允許搜索引擎訪問所有部分
User-agent:*
Disallow:
②禁止搜索引擎訪問任何部分
User-agent:*
Disallow:/
③禁止搜索引擎訪問某幾個(gè)部分
User-agent:*
Disallow:www.registerjl.com/123.html
Disallow:www.registerjl.com/456.html
Disallow:www.registerjl.com/789.html
④允許某個(gè)搜索引擎訪問
User-agent:Baiduspiter
Disallow:/
⑤禁止所有瀏覽器訪問某幾個(gè)目錄下的內(nèi)容及文件
User-agent:*
Disallow:/sss/
Disallow:/aaa/
⑥禁止除了百度瀏覽器以外的所有搜索引擎抓取任何內(nèi)容:
User-agent:Baiduspiter
Disallow:/
User-agent:*
Disallow:/
⑦$:通配符,匹配url結(jié)尾的字符。禁止百度抓取所有.jpg文件
User-agent:Baiduspiter
Disallow:.jpg$