Create a robots.txt for a new site
Allow crawling, block admin paths and point search engines to the sitemap.
A robots.txt is a public hint file, not an access control system. Start with a simple allow-all policy, block only paths that should never be indexed, and keep the sitemap line accurate.
Tool used in this guide
robots.txt generator
How to use it
- 1
List public and private paths
Write down the paths that should be crawled and the ones that should not, such as admin, account or internal search. Remember that a robots.txt block does not protect data.
- 2
Start with a simple policy
Allow everything by default, then add specific disallow rules. Overly broad blocks are a common reason a new site never appears in search results.
- 3
Add the sitemap URL
Point to the absolute sitemap address, for example https://example.com/sitemap.xml. Check that the file returns 200 and lists the URLs you expect.
- 4
Test with the live file
Fetch /robots.txt from the deployed site, confirm the content type is text/plain, and use a search engine’s URL inspection tool for one important page.
Use the tool for this task
robots.txt generator
Build a valid robots.txt with user-agent rules, allow and disallow paths plus a sitemap.
Frequently asked questions
Can robots.txt hide a private page?
No. It asks well-behaved crawlers not to fetch the page, but anyone with the URL can still open it. Use authentication for real access control.
Should I block AI crawlers?
That is a policy choice, not a technical default. Decide consciously, document it, and understand that robots.txt is voluntary for many crawlers.