现在的位置: 首页 > 综合 > 正文

为机器人程序准备的robots.txt文件

2013年05月31日 ⁄ 综合 ⁄ 共 493字 ⁄ 字号 评论关闭

万维网(World Wide Web)机器人程序,会扫描全球的网页,存贮起来做成检索页,但有的时候你的某些网页不希望被机器人所索引,如何解决呢?

解决方法

这需要用到robots.txt文件了。你可把不希望被机器人所索引的目录写在里面,该文件要放在网站的跟目录。

robots.txt文件例子

User-agent: *
Disallow: /product/ 
Disallow: /temp/ 
Disallow: /test.html

这个例子说明对所有机器人开放,但不索引/product/、/temp/目录下所有文件和test.html。

User-agent: *
Disallow: /product/glass/ 
Disallow: /temp/ 
Disallow: /test.html

User-agent: /product/
Disallow:

这个例子说明对所有机器人开放,但不索引/product/glass/、/temp/目录下所有文件和test.html,但可索引/product/下除glass以外的其他目录。

User-agent: *
Disallow: /

这个例子说明网站的所有文件不被机器人所索引。

参考资料 

抱歉!评论已关闭.