①robots.txt純文本文件,網(wǎng)站管理員可以在這里聲明該網(wǎng)站不想robots訪問的部分,所以robots優(yōu)化直接影響著搜索引擎對網(wǎng)站的收錄情況;
②robots.txt必須放置在一個站點的根目錄下,并且文件名必須全部小寫:www.sztqnet.com/robots.txt;
③就算你的網(wǎng)站全部內容都可以被搜索引擎收錄,那也要寫個空的robots.txt;因為有的服務器的設置會使沒有robots.txt的時候返回200狀態(tài)碼和相應的錯誤信息;
# robots.txt file from http://www.sztqnet.com/
# All robots will spider the domain
User-agent:*
Disallow:
1、允許搜索引擎訪問所有部分(一般可不寫)
User-agent:*
Disallow:
2、禁止搜索引擎訪問任何部分
User-agent:*
Disallow:/
3、禁止搜索引擎訪問某幾個部分
User-agent:*
Disallow:http://www.sztqnet.com/404.html
4、允許某個搜索引擎訪問
User-agent:Baiduspiter
Disallow:/
5、禁止所有搜索引擎蜘蛛訪問某幾個目錄下的內容及文件
User-agent:*
Disallow:/sss/
Disallow:/aaa/
8、禁止除了百度蜘蛛以外的所有搜索引擎抓取任何內容:
User-agent:Baiduspiter
Disallow:/
User-agent:*
Disallow:/
9、$:通配符,匹配url結尾的字符。禁止百度蜘蛛抓取所有.jpg文件
User-agent:Baiduspiter
Disallow:.jpg$
10、禁止和允許搜索引擎訪問某個目錄,如:禁止訪問admin目錄;允許訪問images目錄。
User-agent:*
Disallow:/admin/
Allow:/images/
11、禁止和允許搜索引擎訪問某個后綴,如:禁止訪問admin目錄下所有php文件;允許訪問asp文件。
User-agent:*
Disallow:/admin/*.php$
Allow:/admin/*.asp$
12、禁止索引網(wǎng)站中所有的動態(tài)頁面(這里限制的是有“?”的域名,如:index.php?id=8)。
User-agent:*
Disallow:/*?*