Technical SEO

How to read and test a robots.txt file

By Awrda IT · Published 31 Oct 2026 · Updated 31 Oct 2026

A robots.txt file tells crawlers which parts of a site they may request. It controls crawling, not indexing, and it is not a security measure. This guide explains how to read one and how to test a change safely.

The building blocks

A file is made of groups. Each group starts with one or more User-agent lines and is followed by Allow and Disallow rules. A Sitemap line may appear anywhere and is not tied to a group.

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

Sitemap: https://example.com/sitemap.xml

Which rule wins?

For a given crawler, only the most specific matching User-agent group applies; other groups, including *, are ignored for that crawler. Inside the group, every rule whose path matches the URL is considered and the longest matching path wins. If an Allow and a Disallow match with the same length, Allow wins. The characters * (any sequence) and $ (end of URL) are supported. This is the behaviour described in RFC 9309 and Google's documentation.

Common mistakes

  • Blocking a page you want deindexed. If a URL is disallowed, Google cannot see its noindex tag, and the URL may stay in results without a snippet.
  • Blocking CSS or JavaScript that pages need to render.
  • Leaving a staging rule such as Disallow: / on the live site.

Test before you publish

Paste the new file into the Robots.txt Tester, list URLs that must stay crawlable, and check each result and its deciding rule. After deploying, run the Robots.txt Checker to confirm the live file is reachable and returns HTTP 200.

Sources and further reading