Fixing a crawler that is blocked by mistake
The rules that most often block a crawler unintentionally, and how to undo them.
6 min read
If the report shows something blocked that you did not intend, the cause is almost always one of a small number of robots.txt patterns. These are worth knowing because the file does not behave the way most people assume.
A crawler obeys exactly one group
This is the single most misunderstood rule in robots.txt, and it is written into the standard (RFC 9309). A crawler finds the group that names it most specifically and ignores every other group, including User-agent: *.
GPTBot here is not blocked from /admin/. It reads only its own group. If you want a rule to apply to a named crawler, you have to repeat it inside that crawler's group.
The practical consequence
Longest match wins, not first match
Within a group, conflicts are resolved by the longest matching pattern, not document order. If two rules tie in length, Allow wins. That is what makes this work:
A stylesheet at /static/app.css?v=123 stays crawlable, because Allow: /static/ is the longer match. Without that Allow line, a broad query-string rule can block your own rendering assets and stop search engines rendering your pages properly.
A question mark is a literal character
Only * and a trailing $ are special in robots.txt. A ? means an actual question mark, not "optional" as it would in a regular expression. Reading it as a regex is what makes /*?* look like it matches everything, when it only matches URLs that contain a query string.
When robots.txt is not the cause
If robots.txt looks correct and access still fails, work through these in order:
-
Check for a firewall rule
A WAF or bot-management product can block a crawler before robots.txt is ever consulted. The report flags when it sees this. Firewall rules are invisible in robots.txt, so this is a common blind spot.
-
Check meta robots and X-Robots-Tag
robots.txt controls crawling. A
noindexin a meta tag or anX-Robots-Tagheader controls indexing. A page can be perfectly crawlable and still be kept out of results by a header you forgot about. -
Confirm the file is actually served
It must be reachable at the domain root, over HTTP, as plain text. A robots.txt that returns a 404, redirects oddly, or is served as HTML will not be honoured.
-
Verify after deploying
Re-run the check once the change is live. Reading your own repository is not evidence about what your server is serving.
Generate rather than hand-write