Does related subfolders need to be disallowed separately in robots.txt?

前端 未结 1 520
生来不讨喜
生来不讨喜 2021-01-27 20:53

Will disallowing certain folder in robots.txt disallow its related subfolders? Example:

Disallow:/folder/

Will match:

/folder/p         


        
相关标签:
1条回答
  • 2021-01-27 21:40

    Robots.txt has no concept of "folders", it’s just strings. Whatever you specify in Disallow is the beginning of the URL path.

    Disallow: / blocks any URL whose path starts with / (= all pages).

    Disallow: /foo blocks any URL whose path starts with /foo:

    • /foo
    • /foobar
    • /foo.html
    • /foo/bar
    • /foo/bar/doe

    Disallow: /foo/ blocks any URL whose path starts with /foo/:

    • /foo/
    • /foo/bar.html
    • /foo/bar
    • /foo/bar/doe
    0 讨论(0)
提交回复
热议问题