Testing whether a URL is allowed or blocked by your robots.txt is more useful than generating a new robots.txt — because most robots.txt errors come not from writing the rules wrong, but from not knowing which rules apply to which URLs in practice
The previous articles on this site covered robots.txt generation, common robots.txt mistakes, AI crawler directives, the robots.txt vs meta robots vs X-Robots-Tag decision framework, and why robots.txt can't enforce or hide content. This article addresses robots.txt testing methodology — how to systematically verify that your robots.txt rules do what you intend, and the specific patterns that produce unexpected results when tested against real URLs.
The URL matching rules: why intuition fails
Robots.txt path matching follows specific rules that differ from standard glob or regex pattern matching, and these differences produce results that surprise people who assume more powerful matching semantics:
Wildcards in robots.txt:
*matches any sequence of characters (including none)$at the end of a path pattern matches the end of the URL- No other special characters are regex-special —
.,+,?,(,)are treated as literal characters
What this means in practice:
Disallow: /admin — blocks /admin, /admin/, /admin/users, /admin/login, and anything starting with /admin. It does NOT block /administration — because the match is a prefix match, and /administration starts with /admin + i, which extends beyond the disallow pattern... wait, actually, robots.txt prefix matching does match /administration because it begins with /admin. This is the intuition failure — prefix matching catches more than a precise string comparison would.
Disallow: /admin/ — blocks /admin/, /admin/users, /admin/login, but does NOT block /admin (the path without trailing slash). The trailing slash is significant.
Disallow: /*.pdf$ — blocks URLs ending in .pdf. Without the $, /*.pdf would block any URL containing .pdf anywhere in the path.
Testing the specific rules that commonly cause surprises
Case sensitivity: robots.txt path matching is case-sensitive for the path component (but not the User-agent line). Disallow: /Admin does not block /admin. If your CMS generates paths that sometimes capitalize, you may need rules for both cases.
Query strings: robots.txt rules match only the path component of URLs, not query strings. Disallow: /search blocks /search and /search/results but NOT /products?search=term — the ?search=term is a query string, not the path /search.
This matters for faceted navigation and parameter-based URLs: if you want to block ?sort=, ?color=, etc., robots.txt cannot target query parameters directly. You'd need to either: disallow the entire directory that generates these URLs, use URL parameter handling in Google Search Console, or use canonical tags to consolidate these to a single URL.
Fragment identifiers: everything after # is never sent to the server (it's client-side only) and robots.txt doesn't apply to fragment-based "URLs" — though this is rarely a practical concern.
The most important test cases to verify
For any robots.txt rule, test these URL variants:
- The exact URL the rule is meant to block/allow
- The URL without a trailing slash (if your rule has one)
- The URL with a trailing slash (if your rule doesn't have one)
- A URL that's a longer extension of the rule path (
/admin→ test/administration) - Case variations of the path
- The URL with query parameters appended
- A URL that should NOT match the rule (to verify the rule isn't too broad)
For Allow rules combined with Disallow rules: when both apply to the same URL, the more specific rule takes precedence (longest matching path wins). Test both the allowed path and the surrounding disallowed paths to verify the specificity logic works as expected.
Verify: what the testing tool tells you that generation tools don't
A robots.txt generator produces syntactically correct robots.txt — it won't output invalid syntax. What it cannot verify is whether the rules you've written actually block and allow the specific URLs in your site.
A robots.txt tester works differently: you input a URL and a user-agent, and the tool evaluates all applicable rules against that URL to determine whether the crawler would be allowed or blocked. This reveals:
- Whether a URL you intended to allow is inadvertently blocked by a broader disallow rule
- Whether a URL you intended to block is slipping through a gap in the disallow coverage
- Which specific rule is matching and why (if the tool provides rule attribution)
- The interaction between Allow and Disallow rules for the same URL
The Google Search Console URL Inspection tool also performs a form of robots.txt testing for Googlebot — it shows whether Googlebot's crawl attempt was blocked by robots.txt, along with which rule caused the block.
AI crawler directives and testing
Since the previous AI crawlers article, one important testing nuance: AI crawlers (GPTBot, Google-Extended, ClaudeBot, Anthropic-AI) are blocked/allowed using the same User-agent directive mechanism as traditional crawlers. Testing requires specifying the exact user-agent string to evaluate.
User-agent strings must match exactly (case-insensitively). User-agent: GPTBot does not match GPTBot/1.0 — wait, actually, robots.txt user-agent matching is on the agent name only (the string before the first /), so User-agent: GPTBot would match a crawler identifying as GPTBot/1.0. But User-agent: gptbot would also match due to case-insensitivity.
Testing with the specific user-agent (e.g., GPTBot, Google-Extended, anthropic-ai) rather than the general Googlebot is the correct approach when verifying AI crawler blocking.
How to use the Robots.txt Generator & Tester on sadiqbd.com
- Generate first, then test: create your robots.txt rules using the generator, then switch to the tester and input specific URLs to verify the rules behave as intended before deploying
- Test both intended blocks and intended allows: don't only verify that blocked URLs are blocked — also verify that URLs you want crawled are not inadvertently caught by your disallow rules
- Test for each relevant user-agent: if you have separate rules for Googlebot, Bingbot, and AI crawlers, test the same URL against each user-agent to verify the rules apply correctly per agent
Frequently Asked Questions
Why does Google Search Console show a URL as "blocked by robots.txt" even though my robots.txt allows it? A few common causes: the URL in Search Console may be a different variation than the URL you tested (with or without trailing slash, with query parameters, with different casing). The robots.txt that GSC checked may have been a cached version before your recent update (GSC re-crawls robots.txt periodically, not instantly on every change). Or there may be a more general Disallow rule that's overriding a more specific Allow rule — robots.txt uses longest-match specificity, not order of appearance, so a longer Disallow pattern would take precedence over a shorter Allow pattern pointing to the same URL. The URL Inspection tool in GSC shows the fetched robots.txt and the specific rule that matched, which is more diagnostic than the Coverage report alone.
Is the Robots.txt Generator & Tester free? Yes — completely free, no sign-up required.
Try the Robots.txt Generator & Tester free at sadiqbd.com — build robots.txt rules and verify any URL is correctly allowed or blocked for any crawler.