Crawling, robots & indexing directives

robots.txt Allow Directive

Explicitly permits compliant crawlers to fetch a specific subpath inside an otherwise Disallowed directory, governed by RFC 9309 longest-match precedence.

Verified

Syntax / Example

User-agent: *
Disallow: /api/
Allow: /api/public/

Verify On A Live URL

curl -s https://example.com/robots.txt | grep -iE "^(user-agent|allow|disallow):"

Documented Facts For robots.txt Allow Directive

Metric or RuleDocumented ValueSource
Conflict resolution ruleLongest matching path prefix wins (RFC 9309 §2.2.2)RFC 9309: Robots Exclusion ProtocolChecked November 25, 2026
Exact-length tie-breakerAllow wins over Disallow on equal lengthRFC 9309: Robots Exclusion ProtocolChecked November 25, 2026
Group scopingApplies only inside the single most-specific User-agent groupRFC 9309: Robots Exclusion ProtocolChecked November 25, 2026

Official Specification & Google Behavior

Under RFC 9309 §2.2.2, when both Allow and Disallow patterns match a URL, the rule with the longest matching character path wins; if both patterns are identical in length, Allow takes precedence over Disallow.

SEO & Indexing Impact

Lets publishers keep sensitive folders like /api/ blocked while opening public assets, OG images or public endpoints like /api/public/ cleanly.

Backlink Monitoring Verdict
Check longest-match precedence whenever a crawler or backlink auditor reports a blocked URL inside a mixed Allow/Disallow group.

Common Pitfalls

  • Assuming rule order (top-to-bottom) decides precedence—RFC 9309 uses longest pattern match, not line order.
  • Writing Allow: / inside a dedicated AI bot group without repeating private Disallow paths, accidentally exposing /admin/.

Frequently Asked Questions

Does Allow or Disallow win when both match the same URL?
Under RFC 9309, the rule with the longer matching path wins. If both rules have the exact same character length, Allow wins.
Does the order of Allow and Disallow lines matter in robots.txt?
No, compliant parsers evaluate by longest matching path length rather than which line appears first or last.
Do I need Allow: / if I have no Disallow rules?
No, everything is allowed by default unless matched by a Disallow rule, though explicit Allow: / improves human readability.

Primary Sources

Verified

Related Research Guides