These robots.txt examples are practical starting points for common site types. The goal is not to memorize syntax. It is to understand which patterns are safe, which are risky, and when you should use a stronger control than robots.txt.
For a normal brochure site, portfolio, or SaaS marketing site, keep the file simple. Allow crawling by default, block only areas that should not be explored, and include your sitemap.
User-agent: * Disallow: /admin/ Disallow: /private/ Sitemap: https://example.com/sitemap.xml
This pattern is safer than trying to micro-manage every folder. Search engines usually do better when you block less and keep the rules obvious.
For staging, you want a stronger barrier than robots.txt alone. Authentication is the real protection. Still, a fully blocked robots.txt file is a useful extra layer.
User-agent: * Disallow: /
Do not rely on this by itself for anything sensitive. If the staging URL is public and linked somewhere, it can still leak or be indexed from outside references.
For ecommerce, the usual goal is to let product and category pages be crawled while reducing noise from account, cart, and checkout flows.
User-agent: * Disallow: /cart/ Disallow: /checkout/ Disallow: /account/ Disallow: /search Sitemap: https://example.com/sitemap.xml
Be careful not to block product assets, CSS, or JavaScript that search engines need to render the page correctly.
If you want to block AI crawlers, use separate user-agent groups so the rule is explicit. This is clearer than mixing them into one large generic block.
User-agent: GPTBot Disallow: / User-agent: ClaudeBot Disallow: / User-agent: Google-Extended Disallow: / User-agent: CCBot Disallow: /
This affects only bots that respect robots.txt. It is a preference signal, not a guaranteed legal or technical barrier.
If you want a cleaner starting point than copying from blog posts, use the generator and choose a preset that matches your site. You can then add your own folders, sitemap lines, and AI bot rules before copying the final file.
Open the Robots.txt Generator