Updated:
In short
robots.txt is a small file on your site that tells the bots of search engines and AI tools which parts of the site they may visit and which they may not. The rules can be set separately for each bot.
You may also meet the name the robots.txt file.
How robots.txt works
The file sits at /robots.txt. A bot checks it before entering the site. It finds rules there on which parts of the site are closed to it, such as the admin panel or the shopping cart.
User-agent: *
Disallow: /wp-admin/
Allow: /wp-admin/admin-ajax.php
Sitemap: https://yoursite.com/sitemap.xml| Entry | What it means |
|---|---|
User-agent | Which bot the rules below apply to. An asterisk means the bots that have no group of rules of their own in the file. A bot with its own group reads only that group. |
Disallow | What the bot should not read. |
Allow | An exception to a block. |
Sitemap | The address of the sitemap. This record comes from the Sitemaps protocol, not from RFC 9309, and applies to all bots. |
Rules can be set separately for different bots. So you can allow search engines everything and block bots that collect content for training AI models.

robots.txt and noindex: what the file does not do
It does not hide a page from people and it is not a security measure. It also does not guarantee that an address disappears from search results.1 If you want a page to stay out of the results, the noindex setting is the tool for that. Do not block such a page in robots.txt then, because the bot has to open it to see the setting.
The most dangerous robots.txt mistake
A single line can block the whole site. It happens after a site is moved from a test version where the block was intentional. The site then works normally, but over time it loses its positions, and at most bare addresses without a description stay in the results.
There is also trouble when the file does not open because the server returns an error for it (a 5xx code). For the first 12 hours Google does not crawl the site, and then for 30 days it uses the last working version of the file.2 A missing file (a 404 error) does no harm, because the bot then assumes it may read everything.2
Frequently asked questions
What happens if I have no robots.txt file?
Nothing bad. When the file is missing (a 404 error), bots assume they may read the whole site. The file is useful only when you want to block something or point to your sitemap.
Does a subdomain need its own robots.txt?
Yes. The file applies only to the host, protocol and port where it is placed. For example, shop.yoursite.com needs its own file if you want to block something there or point to its sitemap.
In the page code
It is a text file in the root folder of a site. Its rules are described by the Robots Exclusion Protocol standard (RFC 9309). The file is a request to bots, not a security measure. Bots that follow the standard comply with it.
The RFC 9309 standardCheck it yourself
Check whether robots.txt blocks a given page
A single rule can close an important page to search engines. Paste the contents of your robots.txt file, then enter a page path and a bot name.
The tool runs in your browser. We send and store nothing.From our practice
We see a whole site blocked very often. Usually after a move from a development version where the block was intentional. Most often it comes out only when we start SEO work on a finished site. In WordPress one ticked box, “Discourage search engines from indexing this site”, has a similar effect. It does not add a block to robots.txt. Instead it adds
noindexto every page of the site,3 and after launch nobody remembers it.
