A robots.txt file tells crawlers which paths they may access. It is a voluntary convention rather than an enforcement mechanism — reputable crawlers respect it, malicious ones ignore it — but it is still the standard way to keep administrative areas out of search results.
The syntax is small. User-agent names the crawler, Disallow lists paths it should skip, Allow creates exceptions, and a Sitemap line declares the sitemap location. An empty Disallow means everything is permitted, which is the usual choice for a public site; Disallow: / blocks everything, which is occasionally useful on staging environments but disastrous if left in place at launch.
Two mistakes account for most damage. Blocking CSS and JavaScript stops crawlers understanding a page's layout and can hurt rankings, since Google renders pages as a browser would. And blocking a URL does not remove it from the index — pages already indexed need a noindex tag or removal request instead, because a blocked page cannot be recrawled to see the noindex.
Generate standard robots.txt file in one click to solve Google indexing error, discovered not crawled and crawl permission problems.
Frequently Asked Questions
How do I block a folder from search engines?
Add Disallow: /folder/ under the relevant user-agent. Note that this prevents crawling, not indexing, of pages already discovered.
What does Disallow: / do?
Blocks every path on the site. It is useful on staging environments and catastrophic if left in place on a live site.
Should I block CSS and JavaScript?
Generally no. Google renders pages to evaluate them, and blocking stylesheets or scripts prevents it from seeing the page as users do.
How do I remove a page that is already indexed?
Use a noindex meta tag or the removal tool in Search Console. Blocking it in robots.txt prevents the recrawl that would reveal the noindex.