robots.txt
robots.txt is a text file at the root of a website that tells crawlers which parts of the site they may and may not access. It controls crawling, not indexing.
What it's for
- Keeping crawlers out of admin areas, internal search and duplicate parameter URLs.
- Setting rules for specific bots, such as AI crawlers.
- Pointing crawlers to your XML sitemap.
A common mistake
Blocking a page in robots.txt doesn't remove it from search: Google can still index the URL if other pages link to it. To keep a page out of results, allow crawling and use a noindex tag instead.
A simple example
A typical SaaS robots.txt allows everything, blocks a few private areas such as an admin panel or internal search results, and points to the XML sitemap. Rules can target specific crawlers by name, which is how you allow or block AI crawlers individually.
Mistakes to avoid
- Blocking CSS or JavaScript files that pages need to render.
- Using robots.txt to hide a page from results; use a noindex tag instead.
- Leaving a staging rule that blocks the whole site after launch.
- Blocking AI search crawlers by accident through a CDN or security setting.
Quick quiz
Test yourself: robots.txt
Three quick questions. Pick an answer to see why it is right or wrong.
1. What does robots.txt control?
2. How should you keep a page out of search results?
3. What is a common launch mistake?
0 of 3 answered
Frequently asked questions
At yourdomain.com/robots.txt. Every site should have one, even if it allows everything.
Yes, by naming their user agents, such as GPTBot. Most SaaS sites allow the AI search bots so they can be cited.
Not reliably. Google can still index a blocked URL if other pages link to it, without seeing its content. To keep a page out of results, allow crawling and use noindex.