SEO & Web DevelopmentJune 2, 20264 min readAuthor: MondayTool

Robots.txt: What to Block, What to Allow and Common Mistakes

What a robots.txt file does, the rules most sites need, the mistakes that hide a site from search engines, and how to build the file with a free generator.

Open Robots.txt Generator
A simple example of a text-based robots.txt file configuration showing user-agent and disallow paths

A robots.txt file is a plain text file at the root of your site that tells crawlers which paths they may fetch. It is short, but one wrong line can hide a whole site from search engines, and nothing warns you when it happens.

This guide covers what the file does, the rules most sites need, the mistakes that cause real damage, and how to build the file with the Robots.txt Generator.

What robots.txt does, and what it does not do

Before crawling a site, well-behaved bots such as Googlebot and Bingbot request /robots.txt and follow its rules. The file controls crawling, not indexing: a URL you block can still appear in search results, without a description, if other sites link to it. To keep a page out of results, use a noindex tag on a page that crawlers are allowed to fetch.

It is also not security. Bad bots ignore it and anyone can read the file in a browser, so never rely on it to hide private data. Protect that with a password or a login.

The rules you will actually use

  • User-agent: * - the rules below apply to every crawler. Use a bot name such as Googlebot to target one crawler.
  • Disallow: /admin/ - do not crawl this path. A lone Disallow: / blocks the whole site.
  • Allow: /public/ - re-open a path inside a blocked folder.
  • Sitemap: https://yourdomain.com/sitemap.xml - tells crawlers where your sitemap is. Always use the full URL.
  • Crawl-delay: 10 - asks a bot to wait between requests. Bing follows it; Google ignores it.

Two typical files

Allow everything and point to the sitemap: User-agent: * on the first line, an empty Disallow: on the second, and Sitemap: https://yourdomain.com/sitemap.xml on the third. An empty Disallow means nothing is blocked.

Keep a private area out of crawling: User-agent: *, then Disallow: /admin/ and Disallow: /checkout/ on their own lines, then the same Sitemap line. The one-character difference between Disallow: (allow all) and Disallow: / (block all) is the most common reason a site disappears from search.

Mistakes that cause real damage

  • Leaving the staging file in place. Staging sites often use Disallow: / to stay out of search. If that file is copied to the live site, the live site is blocked.
  • Blocking CSS and JavaScript folders. Google needs them to render a page, and a page it cannot render can be judged as not mobile-friendly.
  • Using Disallow when you mean noindex. Blocking a page stops crawling, but the URL can still be listed if it is linked elsewhere.
  • Putting the file in a subfolder. It only works at the root, for example yourdomain.com/robots.txt. Each subdomain needs its own file.
  • Never checking it again. A redesign or platform change can replace the file without anyone noticing.

Building the file with the generator

The Robots.txt Generator starts from four presets: allow all, block all, search crawlers allowed with known AI crawlers blocked, and protect private paths such as /admin/, /private/, /tmp/ and /api/. Pick one, add or remove user-agents from the search engine, ads and AI crawler lists, add Allow and Disallow paths, set an optional crawl delay and a sitemap URL, then copy the result. Save it as robots.txt and upload it to the root of your site.

After uploading, open yourdomain.com/robots.txt in a browser to confirm it is live, then test an important page with the URL Inspection tool in Google Search Console, which tells you whether robots.txt blocks it. Two related tools: the Sitemap Generator builds the file your Sitemap line points to, and the Meta Tag Generator sets the robots meta tag for noindex.

Frequently Asked Questions

Does robots.txt stop people from seeing my pages?

No. It is a request that polite crawlers follow. Anyone can still open a blocked URL, and bad bots ignore the file. Put real private data behind a login.

Where does the file have to live?

At the root of the domain, for example https://yoursite.com/robots.txt. In a subfolder such as /assets/robots.txt, crawlers never look at it and the rules are ignored.

Can I have more than one robots.txt file?

One per host. If you use subdomains such as blog.yoursite.com and app.yoursite.com, each one is a separate host and needs its own file at its own root.

Ready to try it?

Open the tool and follow the steps above. No sign-up needed.

Use Robots.txt Generator

Related Articles

View all