How a robots file blocks a folder
Each group of rules starts with a User-agent line, which says which crawler it's for. An asterisk means every crawler. Below it, Disallow lines list the paths that crawler shouldn't request, such as /basket/ or /search/.
Anything that isn't disallowed is open to crawl, so a shop might block its basket and internal search pages while leaving every product page open. A Sitemap line at the end can point crawlers to your XML sitemap as well.
You can also write rules for one crawler, such as Googlebot or an AI crawler, by giving it a group of its own. Many sites now do this to decide which AI tools can read their pages.
User-agent: *Disallow: /basket/01Disallow: /search/02Sitemap: https://example.co.uk/sitemap.xml
- ··/services/kitchen-fitting/Allowed, so it's crawled
- 01/basket/Disallowed, so it isn't requested
- 02/search/?q=oakDisallowed, so it isn't requested
- 01/basket/ linked from another siteCan still be indexed without being crawled. Use noindex to keep a page out
What a robots file can't do
Blocking a page in robots.txt stops Google from crawling it, but not from indexing it. If other pages link to a blocked address, Google can still list it in the results, usually without a description.
To keep a page out of search results, let Google crawl it and add a noindex tag instead. For anything private, such as customer accounts or staff areas, a password is the only safe option.
Common robots file mistakes
The most damaging one is a stray Disallow: /, often left over from a test site, which asks crawlers to skip the whole website. Blocking CSS or JavaScript files is another, as it can stop Google from seeing a page the way visitors do.
When two rules match the same address, Google follows the more specific one. It's worth testing any change in Search Console before relying on it.
Bird's own robots files
Our live site and the new version we're building each have a robots file, and our free checker reads them the way Google does.
bird.co.uk/robots.txt User-agent: *Disallow: /wp-content/uploads/quformSitemap: https://bird.co.uk/sitemap_index.xmlThe live file on bird.co.ukOur current site's file is written by the Yoast plugin. It lets every crawler in, asks them to skip the folder a form plugin uses for uploads, and points them to the sitemap.
The new site's robots.txt // Allow crawling to see noindex; robots exclusion alone does not prevent indexing.return new Response(`User-agent: *\nAllow: /\nOpen to crawl so noindex can be readThe new site allows every path on purpose. While it's being built, its pages carry a noindex tag, and Google can only see that tag if it's allowed to crawl the page.
Our noindex checker matched.sort((a, b) => b.length - a.length || Number(b.allow) - Number(a.allow),);The longest matching rule winsOur free noindex checker reads the site's robots file as part of its check. When more than one rule matches, it picks the longest. An Allow beats a Disallow of the same length, which is how Google settles a tie.

