Every site has paths crawlers have no business fetching: an admin area, a temporary folder, a page built for one narrow purpose. Blocking them takes a single line in your robots.txt file. What catches people out is not the line but what they expect it to do. Blocking stops search engines crawling the page. It does not take the page out of search results, and it does not stop anyone opening it.

This guide shows how to block a page or a whole folder with the free Robots.txt Generator on Ovatly, explains what a Disallow line does and does not do, and covers the cases where blocking is the wrong tool and a noindex tag or deleting the page is the honest answer.

Contents

  • Quick answer
  • What blocking actually does
  • How a Disallow line works
  • How to block a page or folder, step by step
  • Worked example: an admin area and a temporary folder
  • When blocking is the wrong tool
  • Limitations and alternatives
  • Common mistakes
  • FAQs
  • Conclusion

Quick answer

To block a page or folder, add a Disallow line naming its path inside a rule group: Disallow: /admin/ blocks the admin folder and everything under it for the crawlers in that group, and a line naming a single page path blocks just that page. Build the file with the Robots.txt Generator, place it at the root of your domain, and test it before publishing. Then hold the limit in mind: the block stops crawling only. A blocked page can still appear in results if other sites link to it, shown without a snippet, and anyone can still visit it directly. For removal from results, blocking is the wrong tool; use a noindex tag or remove the page.

What blocking actually does

A robots.txt file controls crawling: which paths a crawler may fetch. When a crawler reads your file and finds its group disallowing a path, it skips that path. That is the whole effect, and it is genuinely useful: crawlers stop spending visits on your admin area, temporary files and any other section that has no place in an index.

Three things blocking does not do follow directly. It does not control indexing: a page the crawler never fetched can still be listed in results if other sites link to it, because the engine knows the address exists without having read the content. It is not security: the page is still live and reachable by anyone who types or follows its address; robots.txt is instructions to well-behaved crawlers, not a lock. And it does not hide the path: the file itself is public, so blocked paths are listed in plain sight. Never block a path to keep it secret; the file would announce it.

How a Disallow line works

Robots.txt is organised into rule groups. Each group starts with a User-agent line naming the crawlers it applies to; * means all crawlers. Under it, each Disallow line names a path prefix. Prefix is the key word: the crawler will not fetch that path or anything beneath it, so Disallow: /admin/ covers the folder, the pages inside it and any folders below those, all with one line. To block a single page instead, name the page's own path.

Two refinements matter. First, groups let you block differently for different crawlers: the main group can use *, and you add another group when one named crawler needs different rules. Second, an Allow line reopens a more specific path inside a disallowed area: if a folder is blocked but one page inside it should stay crawlable, an Allow line naming that page does it, because when both match, the longest pattern wins. One more detail: a Disallow: line with nothing after it blocks nothing, and the generator only writes Disallow lines for paths you enter.

How to block a page or folder, step by step

  1. Open the Robots.txt Generator.

  2. In the first group, list the user agents the rules apply to. Use * to block the path for all crawlers, which is what most blocking jobs want.

  3. Add a Disallow line for each path to block, one per line: a folder path to block the folder and everything in it, or a page path to block just that page. Add an Allow line for any path inside a blocked area that must stay open.

  4. Add another group only if one crawler needs different rules.

  5. Add your sitemap URL, then copy or download the generated robots.txt and place it at the root of your domain, at an address like https://example.com/robots.txt. Each subdomain needs its own file.

  6. Before relying on it, test the file with the Robots.txt Tester: paste the generated content and check a few real paths, the blocked ones and, just as carefully, the ones you meant to keep crawlable.

Worked example: an admin area and a temporary folder

Say a site wants crawlers kept out of its admin area and temporary folder, with the sitemap still advertised. One group does the job:

User-agent: *
Disallow: /admin/
Disallow: /tmp/

Sitemap: https://example.com/sitemap.xml

Read the result line by line. The User-agent: * line puts every crawler in this group. Each Disallow line blocks its prefix, so nothing under /admin/ or /tmp/ gets fetched. The Sitemap line points crawlers at the pages the site does want indexed. And the honest footnote: after this file goes live, a page inside /admin/ that another site links to can still show up in results as a bare address without a snippet. The block did its job, stopping the crawling. It was never able to do the other job.

When blocking is the wrong tool

The most common wrong job is removal. If a page is already indexed and you block it, the address usually stays in results without a snippet, because the crawler can no longer fetch the page to see anything that would change its status. To remove a page from results, use a noindex tag or remove the page itself, and let crawlers fetch it so they can see that instruction.

The second wrong job is protection. A login page, a private document or a staging area is not made private by a Disallow line: the page stays reachable, and the robots.txt file naming its path is public reading. Protect such pages with authentication or by not publishing them, and keep their paths out of your robots.txt entirely. Blocking is for steering crawlers away from paths that are public but pointless to crawl: admin screens, temporary folders, utility pages. For starting patterns across site types, see Robots.txt Examples for WordPress, Shopify and Custom Sites.

Limitations and alternatives

A block only binds crawlers that respect robots.txt, and only for the host the file sits on; subdomains need their own files. Crawl-delay, the optional line asking crawlers to pace their requests, is honoured by some crawlers such as Bing and ignored by Googlebot. And a block can be too broad as easily as too narrow: because a Disallow covers everything under its prefix, one careless line can close off a section you wanted indexed, which is why testing the file against real paths is part of the job.

Common mistakes

  • Blocking a page to remove it from Google. The address usually stays in results without a snippet. Removal needs noindex or deletion.
  • Blocking a page to keep it secret. The page stays reachable and the public file lists its path. Blocking advertises; it does not hide.
  • Blocking a folder when only one page was meant. A Disallow covers everything under the prefix. Check what else lives under that path first.
  • Blocking everything by accident. A Disallow line naming the root path closes the whole site to that group's crawlers. Read the generated file before uploading it.
  • Never testing the result. Run the finished file through the tester with paths you blocked and paths you value. The second group is where the expensive surprises live.

FAQs

What is the difference between Allow and Disallow? Disallow tells crawlers not to fetch paths under a prefix; Allow reopens a more specific path inside a disallowed area. When both match, the longest pattern wins.

Does an empty Disallow line matter? "Disallow:" with nothing after it means nothing is blocked for that group. The generator only writes Disallow lines for paths you actually enter.

How do I test the file before uploading it? Use the Robots.txt Tester on this site with the generated content and a few real paths from your site, especially anything you meant to keep crawlable.

Can robots.txt remove a page from Google? No. Blocking a page that is already indexed usually keeps the URL in results without a snippet. Use a noindex tag or remove the page for deindexing.

Does every subdomain need its own robots.txt file? Yes. The file must live at the root of the host, for example https://example.com/robots.txt, and each subdomain needs its own file.

Conclusion

Blocking with robots.txt is one honest line of work: a Disallow line in the right group, a folder prefix to close a section or a page path to close a page, the file at the root of the domain and tested before it goes live. Its limit is just as simple: it steers crawlers; it does not remove, hide or protect anything. Build your file with the Robots.txt Generator, keep removal jobs for noindex and deletion, and browse the SEO Tools guides for neighbouring tasks.