What is a robots.txt file?
A robots.txt file is a plain text file at the root of a website that tells crawlers which paths they may request. Search engines and many AI bots read it before anything else. Without the file, crawlers assume they may fetch every public page.
What do the robots.txt directives mean?
| Directive | What it does | Example |
|---|---|---|
| User-agent | Names the crawler the rules apply to | User-agent: GPTBot |
| Disallow | Blocks a path | Disallow: /checkout/ |
| Allow | Makes an exception inside a blocked path | Allow: /checkout/help |
| Sitemap | Points to your XML sitemap | Sitemap: https://www.example.com/sitemap.xml |
An empty Disallow: line allows everything. A single slash after it blocks the whole site, which is the most expensive typo in SEO.
A safe robots.txt for most websites
User-agent: *
Disallow: /admin/
Sitemap: https://www.example.com/sitemap.xml
Start here and add rules only when you have a reason. Blocking CSS or JavaScript folders can stop Google from rendering your pages properly.
How do you block AI bots and keep Google?
Name the training bots and leave Googlebot alone. The "Block AI training" preset does this for you. Google-Extended is a separate control, and Google says it doesn't affect Search. Our guide on how to block GPTBot explains which bots to name.
Does Disallow remove a page from Google?
No. Disallow stops crawling, but a blocked URL can still appear in results if other sites link to it. To keep a page out of the index, let Google crawl it and add a noindex tag.
After uploading, run the AI crawler checker on your domain to confirm that the live file matches what you built. Sites that publish docs can add an llms.txt file as well.