例1. 禁止所有搜索引擎访问网站的任何部分 User-agent: * Disallow: / 例2. 允许所有的robot访问 (或者也可以建一个空文件 "/robots.txt") User-agent: * Disallow: 或者 User-agent: * Allow: / 例3. 仅禁止baiduspider访问您的网站 User-agent: baiduspider Disallow: / 例4. 仅允许baiduspider访问您的网站 User-agent: baiduspider Disallow: User-agent: * Disallow: / 例5.禁止spider访问特定目录 在这个例子中,该网站有三个目录对搜索引擎的访问做了限制,即robot不会访问这三个目录。需要注意的是对每一个目录必须分开声明,而不能写成 "Disallow: /cgi-bin/ /tmp/"。 User-agent: * Disallow: /cgi-bin/ Disallow: /tmp/ Disallow: /~joe/ 例6. 允许访问特定目录中的部分url User-agent: * Allow: /cgi-bin/see Allow: /tmp/hi Allow: /~joe/look Disallow: /cgi-bin/ Disallow: /tmp/ Disallow: /~joe/ 例7. 使用"*"限制访问url 禁止访问/cgi-bin/目录下的所有以".htm"为后缀的URL(包含子目录)。 User-agent: * Disallow: /cgi-bin/*.htm 例8. 使用"$"限制访问url 仅允许访问以".htm"为后缀的URL。 User-agent: * Allow: .htm$ Disallow: / 例9. 禁止访问网站中所有的动态页面 User-agent: * Disallow: /*?* |
|