How to build a robots.txt file safely
Start by checking your existing file before replacing it. Save a backup so you can restore earlier rules if needed.
Choose the crawler group you want to manage. The wildcard user agent applies broadly, while named groups target specific crawlers.
Add paths carefully, then review the preview and crawler matrix. Download the file only after checking every rule against your intended policy.
Understand Allow and Disallow with an example
A Disallow rule for /drafts/ asks matching crawlers to avoid that directory. An Allow rule can describe a more specific permitted path.
For example, a site could restrict /drafts/ while allowing /drafts/public-example/. Check overlapping rules with the crawler documentation before publishing.
Paths are case sensitive. A small spelling change can affect which URLs match, so copy paths from real pages rather than guessing.
Separate crawler access from indexing and privacy
Robots.txt manages crawling requests. A blocked URL may still appear in search results when other pages link to it.
Use a supported noindex directive when your goal is removing a page from search. The crawler must access the page to see that directive.
Protect confidential pages with authentication or server access rules. Never publish secret paths or assume a robots rule secures a document.
Review AI crawler choices individually
Decide separately whether you want discovery in search products and use for model training. Read each operator policy before choosing a rule.
The matrix helps review named groups, but it does not prove that every bot will obey them. User-requested fetches can follow different policies.
Avoid blocking useful search access accidentally when your intention is only to restrict training. Recheck your policy when vendors change their documentation.
Publish and test the final file
Place robots.txt at the root of the relevant host, such as https://example.com/robots.txt. Each subdomain needs its own configuration.
Open that address after deployment. Confirm that it returns the intended plain text rather than a login screen or an HTML error page.
Check important URLs in Search Console and monitor crawling after changes. Keep required styles and scripts accessible so search engines can render public pages.
Troubleshoot unexpected results
If a live import fails, confirm that the host is public and the address is correct. You can still build rules manually.
If the file looks correct but access fails, inspect firewall rules and hosting protection. Robots.txt is only one part of the access path.
Review the file after migrations, staging launches, and major URL changes. Remove temporary restrictions before making a site public.