IT Glossary
What is a robots.txt file and how to write it right
The public file where a site tells search robots which URLs to stay away from and where to find its sitemap.
- 6
- sections
- 5
- questions answered
Robots.txt is a plain text file that must sit at the root of a website (example.com/robots.txt), where you tell each search robot which URLs it may fetch and which to skip; the rules have been standardised since September 2022 in RFC 9309 and control crawling of pages, not their indexing. Before reading any page, Google's robot requests this file. It is a few lines long but disproportionately powerful: a Disallow: / left switched on after launch stops crawling of the whole site, and the pages drop out of results or show up without a description while the site works normally for visitors.
For your business the rule is simple: set the file up once, correctly, and re-check it after every relaunch or migration. The file is public, any visitor can read it, so it hides nothing: to keep a page out of Google you use noindex or a password, not Disallow.
Why it matters for your business
Robots skip endless URL spaces
Internal search, filter combinations and the cart can generate endless addresses. Blocking them matters for stores with faceted navigation; a small presentation site has no crawl-budget problem.
The map and the rules in one place
A small file with a Sitemap line gives every robot the rules and the site map together. To keep a URL out of Google you use noindex or a password, not this file.
A safety net at launches and migrations
Checking robots.txt is the one-minute test that prevents the classic disaster: a new site shipped with robots blocked and organic traffic collapsing for no visible reason.
A robots.txt example, annotated line by line
The northdan.com file, checked on 18.11.2026, has three lines. User-agent: * means the rules apply to any robot. Allow: / leaves the whole site open. Sitemap: https://northdan.com/sitemap.xml points to the site map so the robot does not have to look for it. A presentation site needs nothing more.
An online store adds rules for areas with no search value: User-agent: * then Disallow: /cos/, Disallow: /cont/ and Disallow: /*?filtru=, plus Sitemap: https://exemplu.ro/sitemap.xml. The first two stop the cart and the customer account; the third stops any address with the ?filtru= parameter.
Paths are case-sensitive, * stands for any string of characters and $ marks the end of the URL (RFC 9309, section 2.2.3). When several rules match, the most specific one, meaning the longest, wins, and on a tie Allow wins (section 2.2.2). AI robots have their own group, for example User-agent: GPTBot followed by Disallow: /; whether to block them is a decision covered under crawler.
The RFC 9309 rules and how Google applies them
The protocol was defined by Martijn Koster in 1994 and became a standard in September 2022 as RFC 9309. Rules apply separately to each host, protocol and port: www.example.com and example.com each have their own file.
Google reads at most 500 KiB of the file; anything beyond is ignored. It caches the file for up to 24 hours, so a change does not take effect at once. If /robots.txt answers with 4xx (other than 429), Google treats it as no rules and crawls everything. If it answers with 5xx, Google stops crawling the site for 12 hours, then uses the last good copy for up to 30 days.
Google supports only four directives: user-agent, allow, disallow and sitemap. Crawl-delay is ignored. Since 1 September 2019 Google also ignores noindex and nofollow written in robots.txt.
Want an estimate for your project?
Message us on WhatsApp. We reply the same working day, and the first 30-minute call is free.
What robots.txt does not do: indexing and security
RFC 9309 states that these rules are not a form of access authorization, and the paths listed are visible to anyone. A staging site or an admin area is protected with a password, not with Disallow: the line only announces publicly where it is.
Google's documentation warns that robots.txt is not a mechanism for keeping a page out of Google: a blocked URL can still be indexed when other sites link to it, shown without a description. The noindex tag works only if the page can be crawled, otherwise the robot never reads it.
Checking after a launch or migration
Open yoursite/robots.txt in a browser and look for a Disallow: / under User-agent: *. In Search Console, under Settings, the robots.txt report shows the last fetch, its status, the errors and the versions of the last 30 days, and after a fix you can request a recrawl, otherwise the 24-hour cache delays the effect. For a single address use URL Inspection.
For a migration, Google's guide says to prepare the final file before the move and to remove, afterwards, blocks that existed only for the migration. If there is no file, the server must return a real 404. The other half of a migration is the 301 redirects from the old addresses to the new ones.
Frequently asked questions
How do I check my own robots.txt file?
Open your domain in a browser followed by /robots.txt and look for the line Disallow: / under User-agent: *, which blocks the whole site. In Search Console, the robots.txt report under Settings shows how Google read the file and lets you request a recrawl after a fix; without it, the cache of up to 24 hours delays the effect.
If I block a page in robots.txt, does it disappear from Google?
Not necessarily: robots.txt stops crawling, not indexing. If other sites link to the blocked page, Google may still list it in results without a description. For real exclusion you use noindex or a password, and noindex works only if the page is not blocked in robots.txt, otherwise Google cannot read the tag.
What belongs in the robots.txt of an online store?
Product and category pages stay open, while the blocks target the cart, checkout, account, internal search and the filter combinations with endless addresses, plus the Sitemap line. Exact settings depend on the platform: many ship reasonable defaults that need adjusting, not rewriting.
Can I put noindex in robots.txt?
No: Google has not honoured noindex written in robots.txt since 1 September 2019. Use the robots meta tag or the X-Robots-Tag header, on a page the robot is allowed to crawl. The same applies to nofollow and crawl-delay in this file.
What happens if my site has no robots.txt?
A 404 response means Google may crawl every URL, which is fine for a small site. The dangerous case is a server error (5xx) on /robots.txt: Google stops crawling the site for 12 hours, then uses the last good copy of the file for up to 30 days.
Let’s talk about your project
Book a free 30-minute call or send us an email. We reply the same working day.
office@northdan.com · +40 750 252 851