robots.txt, hands on
Part 5 · Reaching a site4 minEdit a real robots.txt and watch eight crawlers react, judged by the parser a scan uses: groups, the longest rule, patterns, borrowed and merged rules.
- GPTBotallowed
- OAI-SearchBotallowed
- ClaudeBotallowed
- Claude-Userallowed
- PerplexityBotallowed
- Googlebotallowed
- Applebotallowed
- Bingbotallowed
Try the file
The file on the left is a real robots.txt, and you can edit it. The path is the page a crawler wants. Each crawler on the right shows what the file tells it.
The answers come from the same parser a Braille scan uses on a site’s own file. Hover a crawler to see the line that decided it.
Why it matters. The verdicts are computed, not drawn: change the file or the path and they change with it.
One group for everyone
A file with one group, “User-agent: *”, speaks to every crawler at once. Here it keeps them all out of /cart.
Nothing in this file names a crawler, so all eight read the same group and get the same answer.
- Group
- One or more User-agent lines and the rules under them, up to the next User-agent line.
Why it matters. With only a * group, one rule reaches every crawler, and one mistake does too.
A group of its own
Now GPTBot has a group of its own. It reads only that group: the * rules no longer apply to it, so /cart is open to it.
This is the most common surprise in real files. A check of the file has to read it as each crawler does, not top to bottom.
Why it matters. Once a crawler has a group of its own, only that group counts for it. Repeat the shared rules there.
The longest rule wins
When several rules match a path, the longest one decides. Disallow: /shop matches, but Allow: /shop/guides matches more of it.
So the guides stay open while the rest of the shop is closed. If an Allow and a Disallow are the same length, Allow wins.
Why it matters. Between matching rules, the most specific one decides. Where they are equally long, Allow wins.
Patterns in a path
A rule can use the star, any run of characters, and the dollar sign, the path ends here.
Here /*?sort= keeps crawlers out of every sorted copy of a list, and /*.pdf$ out of PDF files, wherever they sit on the site.
Why it matters. Two characters do the matching: * for anything, $ for the end. Everything else is a plain prefix.
Borrowed rules
Some crawlers fall back on another one’s group. Apple documents that Applebot follows the Googlebot rules when a file names Googlebot and not Applebot.
This file only meant to block Googlebot. Applebot is blocked too, and with it Siri and Spotlight.
Why it matters. A crawler can read another crawler’s rules. Blocking Googlebot also blocks Applebot unless Applebot has its own group.
Groups that merge
A crawler named in two groups follows the rules of both.
Here Cloudflare’s block says Disallow: /, and the site’s own only /cart. Read as one, every page is closed.
Why it matters. Two groups that name the same crawler are one group to it. Search the whole file for each name.