Robot.txt禁止页面但不是以

时间:2016-07-12 15:33:47

标签: robots.txt

我想禁止特定页面

  

example.com/10

但不是以/ 10

开头的其他页面
  

example.com/101

     

example.com/102

     

example.com/103

怎么做?

1 个答案:

答案 0 :(得分:1)

您可以使用Allow关键字来实现它:

User-agent: *
Allow: /10*
Disallow: /10$

http://tools.seobook.com/robots-txt/analyzer/的结果:

Url: /10
Multiple robot rules found 
Robots disallowed: All robots

Url: /101
Robots allowed: All robots

Url: /102
Robots allowed: All robots

Url: /103
Robots allowed: All robots

但是,较旧的机器人可能会正确解释它。例如,只读第一行。

相关问题