Robots & Sitemap Checker

Guides › robots.txt basics

Allow vs Disallow: which rule wins in robots.txt?

When several rules in a group match a URL, Google (and RFC 9309) use the most specific rule, meaning the one with the longest path. If an Allow and a Disallow are equally long, Allow wins. The order of lines in the file doesn't matter.

User-agent: *
Disallow: /shop/
Allow: /shop/sale/
URLMatching rulesResult
/shop/shoesDisallow: /shop/ (6)Blocked
/shop/sale/bootsDisallow: /shop/ (6), Allow: /shop/sale/ (11)Allowed (longer)
/aboutnoneAllowed

Equal-length tie

User-agent: *
Disallow: /page
Allow: /page

/page is allowed, because Allow wins the tie. With wildcards the "length" is the length of the pattern as written, so /*.pdf counts as 6 characters.

Other crawlers

Older or simpler crawlers may use first-match-wins instead. If you need consistent results everywhere, avoid overlapping rules where you can. The checker shows which line decided each crawler's verdict, using Google's longest-match logic.

Check your site now

Related

robots.txt syntax: every directive explainedrobots.txt wildcards: how * and $ workNoindex in robots.txt doesn't work: what to do insteadCrawl-delay in robots.txt: who honours itWhat happens when robots.txt returns 404, 403 or 500

More free tools from Swift Labs

OG Preview Tool
Preview links on Facebook, LinkedIn, X and Slack, and audit Open Graph tags.
Email DNS Check
Check SPF, DKIM, DMARC and MX records in seconds.
DeadLinkPatrol
Find broken links across your whole site.