How to create a robots.txt file for SEO

Control crawler access without accidentally blocking important pages.

Author's note:

Although it may seem like a very technical topic, it is essential to pay attention to your robots.txt file so you do not block your site's indexing. With our tool, you can generate it easily in seconds and make sure search engines crawl what matters to you.

robots.txt file configured to control crawling of a website

Use precise rules

Start with User-agent: *, then allow the public site and disallow only paths that should not be crawled. robots.txt is not an access-control system and does not guarantee de-indexing.

Add your sitemap URL and test the file after publishing. Use the robots.txt generator to prepare a starting file.

How crawler rules work

Rules are grouped by user agent. A general group can describe the default policy, while more specific groups can target a particular crawler. Keep the file readable and test every disallow rule against the paths you actually intend to restrict.

Disallowing a path is not the same as removing a URL from search results, and robots.txt should never protect private information. Use authentication for private areas and use appropriate indexing directives where you control the page response.

Common mistakes to avoid

  • Blocking CSS or JavaScript needed to render the page.
  • Blocking the entire site with a rule copied from a staging environment.
  • Using robots.txt as an access-control mechanism.
  • Listing a sitemap URL that does not match the live site.
  • Forgetting that each path rule should be tested after deployment.

After publishing, inspect the file directly, check important URLs and monitor crawl or indexing reports. Make the smallest rule change that solves the actual crawl problem.