I would like to allow a path and disallow everything else in the directory.
User-Agent: *
Allow: /example/
Disallow: /example/*
Will this work? If not what would be a better way of doing this?
I actually found this helpful.
https://moz.com/community/q/robots-txt-how-to-exclude-sub-directories-correctly
User-Agent: *
allow: /example/$
disallow: /example/*
Allow
directive and regular expressions. Googlebot will obey that properly, and probably Bingbot. Not many other user agents will though.
Commented
Apr 2, 2019 at 19:59