Robots.txt Generator: Write and Test Crawler Rules
robots.txt generator: Create a robots.txt file with specific crawler rules, test allowed paths, and avoid using crawl blocking to hide private pages.

A robots.txt file gives compliant crawlers instructions about which URL paths they may request. It is a crawl-control mechanism, not a password or reliable way to hide a page from search. Put the file at the site root for the exact host and protocol it covers, then test rules against the URLs you care about. A restrictive rule can prevent crawlers from fetching important pages, so keep a copy of the previous file before publishing changes.
Write rules for the right user agent
Each group begins with a User-agent line and may include Allow or Disallow paths. A wildcard group applies to crawlers that do not have a more specific group. Rules match URL paths and are case-sensitive on many servers. Start with a narrow path instead of blocking a broad directory unless you have checked every affected page. Different search engines can implement details differently, so use their current documentation for complex patterns.
Do not use robots.txt for confidential data
A disallowed URL can still be discovered from links and may appear in search results without a description. Robots rules do not require a crawler to keep content secret, and malicious bots may ignore them. Protect private content with authentication or server-side access controls. Use noindex where a page should not appear in search and the crawler is allowed to fetch it; do not block that fetch before the crawler can see the directive.
Test before publishing
Compare the rules against important page paths and confirm that assets needed to render pages remain crawlable. Test both allowed and blocked examples, including trailing slashes and uppercase path variants. Publish the file at /robots.txt and inspect the exact live URL for each subdomain or protocol where rules differ. Monitor crawl reports after deployment. A syntax-valid file can still contain a logic error that blocks the wrong section of a site.
Worked example
User-agent: *
Disallow: /private-preview/
Allow: /private-preview/public-example
Sitemap: https://example.com/sitemap.xmlCan robots.txt keep a page out of Google?
It can restrict crawling, but it does not guarantee deindexing or privacy. Use authentication for private content and a supported noindex directive for search exclusion.


