How crawlers read robots.txt
- Pick a group. A crawler looks for the group whose User-agent line names it, matching the name case-insensitively and ignoring any version (
Googlebot/2.1counts as Googlebot). If no group names it, it usesUser-agent: *. If there’s neither, everything is allowed. Groups that name the same crawler are combined. Applebot falls back to the Googlebot group, and Bingbot to an old msnbot group, before*. - Find the matching rules. Each Allow and Disallow path is compared with the start of the URL path, including the query string.
*matches anything and a final$means the URL must end there. - The most specific rule wins. The longest matching path decides; on a tie, Allow wins. With no matching rule, the URL is allowed.
/robots.txtitself is always allowed.
A crawler that gets a 4xx answer for robots.txt treats the whole site as allowed; a 5xx answer or a failed request makes it stay away. robots.txt controls crawling, not indexing: a blocked page can still appear in search results when other pages link to it. To build a file from scratch, use the robots.txt generator; to see what each bot actually gets from your server, run the full check.