Wildcards in robots.txt

只愿长相守 提交于 2019-11-28 02:14:15

Note that the * wildcard in Disallow is not part of the original robots.txt specification. Some parsers support it, but as there is no specification, they might all handle it differently.

As you seem to be interested in Googlebot, have a look at Google’s robots.txt documentation.

In the examples it becomes clear that * means

any string

"Any string" may, of course, also contain /.

So your first line Disallow: /parent/* should block every URL whose path starts with /parent/, including path segments separated by slashes.

Note that this would be the same as Disallow: /parent/ in the original robots.txt specification, which also blocks any URL whose paths starts with /parent/, for example:

  • http://example.com/parent/
  • http://example.com/parent/foo
  • http://example.com/parent/foo.html
  • http://example.com/parent/foo/bar
  • http://example.com/parent/foo/bar/
  • http://example.com/parent/foo/bar/foo.html
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!