Robots協(xié)議(也稱為爬蟲(chóng)協(xié)議、機(jī)器人協(xié)議等)的全稱是“網(wǎng)絡(luò)爬蟲(chóng)排除標(biāo)準(zhǔn)”(Robots Exclusion Protocol),您可以在您的網(wǎng)站中創(chuàng)建一個(gè)純文本文件robots.txt,在文件中聲明該網(wǎng)站中不想被robot訪問(wèn)的部分或者指定搜索引擎只收錄特定的部分。
珠海網(wǎng)絡(luò)推廣
robots.txt文件的用處是非常大的,它在網(wǎng)站建設(shè)和
SEO優(yōu)化中起著很關(guān)鍵的作用。搜索引擎在訪問(wèn)任意網(wǎng)站的網(wǎng)頁(yè)之前,都會(huì)查看是否存在阻止它們?cè)L問(wèn)特定網(wǎng)頁(yè)的robots.txt文件。
我們給出樣本,并且應(yīng)該把robots.txt文件放置在網(wǎng)站根目錄下:
User-agent: {SpiderNameHere}
Disallow: {FileNameHere}
譬如,如果您想告訴Excite搜索引擎的Spider(ArchitextSpider),不檢索您站點(diǎn)中三個(gè)特定頁(yè)面,您可這樣操作:
User-agent: ArchitextSpider
Disallow: /orderform.html
Disallow: /product1.html
Disallow: /product2.html
如果您不想讓Excite的Spider檢索在abc目錄下的def.htm文件:
User-agent: ArchitextSpider
Disallow: /abc/def.htm
不檢索整個(gè)mydirectory目錄:
User-agent: ArchitextSpider
Disallow: /mydirectory/
不讓所有Spider檢索:
User-agent: *
不檢索整個(gè)站點(diǎn):
Disallow: /
我們給出其他實(shí)例:
User-agent: ArchitextSpider
Disallow: /abc/def.htm
User-agent: Infoseek
Disallow: /ghi/jkl.htm
User-agent: ArchitextSpider
User-agent: Infoseek
Disallow: /abc/def.htm