Start with
User-agent: *andAllow: /, addSitemap:, block only what must be blocked, and verify with the robots tester.
robots.txt that protects without hiding
Default to allow
User-agent: *followed byAllow: /is the safe default. Then addDisallow:for specific paths.One sitemap per line
Sitemap:can be repeated. List every sitemap and sitemap-index.Block only admin and search
/admin/,/search/,/*?s=are the safe blocks. Blocking the whole/is never right.Test with Search Console
The "robots.txt tester" in Search Console validates the syntax and simulates a fetch. Use it before every deploy.
Never block the sitemap
A
Disallow: /sitemap.xmlblocks the sitemap itself. If a rule blocks sitemaps, the crawler cannot discover URLs.