Eksempler
A blocked folder with one allowed sub-folder
Du skriver inn
- Robots.txt
- User-agent: *
Disallow: /private/
Allow: /private/press/
- Crawler
- anybot
- URL-er
- https://example.com/private/report.pdf; https://example.com/private/press/kit.html; https://example.com/blog/
Du får
- report.pdf
- blocked by Disallow: /private/
- kit.html
- allowed by Allow: /private/press/
- Blogg
- allowed, no rule matches
Both rules match the press page, and the Allow rule has the longer path, so it wins. The blog address matches nothing, and an address with no matching rule is allowed.
Kjørt med verktøyets egen kode.
A crawler with its own group
Du skriver inn
- Robots.txt
- User-agent: *
Disallow: /
User-agent: Googlebot
Allow: /
Disallow: /tmp/
- Crawlere
- Googlebot; Bingbot
- URL-er
- https://example.com/a; https://example.com/tmp/x
Du får
- Googlebot
- /a: allowed; /tmp/x: blocked
- Bingbot
- /a: blocked by Disallow: /
Googlebot has its own group, so the star group is ignored for it. Bingbot has no group of its own, so it falls back to the star group, which blocks everything.
Kjørt med verktøyets egen kode.
A wildcard with an end anchor
Du skriver inn
- Robots.txt
- User-agent: *
Disallow: /*.pdf$
- Crawler
- Googlebot
- URL-er
- https://example.com/a.pdf; https://example.com/a.pdf?x=1; https://example.com/files/b.PDF
Du får
- a.pdf
- blocked
- a.pdf?x=1
- allowed
- b.PDF
- allowed
The dollar sign means the address must end there, so adding a query string escapes the rule. Path matching is case sensitive, so the capital letters in b.PDF also escape it.
Kjørt med verktøyets egen kode.
Allow and Disallow of equal length
Du skriver inn
- Robots.txt
- User-agent: *
Disallow: /shop
Allow: /shop
- Crawler
- anybot
- URL-er
- https://example.com/shop
Du får
- Butikk
- allowed by Allow: /shop
- Matchende regler
- 2
When two matching rules are equally specific, the tool lets the Allow rule win. RFC 9309 says an allow rule should be used when allow and disallow rules are equivalent.
Kjørt med verktøyets egen kode.