Robots.txt Generator

Create a robots.txt file, then review crawling restrictions before publishing it at your domain root.

FreeNo sign-upRuns in your browser: your data is not uploaded


How to generate and publish robots.txt

Open the current /robots.txt on your site and save a copy. Identify paths you want crawlers to reach and paths you want them to skip.

  1. Set User agent to * for a general rules group. Use a specific crawler token when you intentionally want a group for that crawler, such as Googlebot.
  2. Enter a single path per line in Disallow paths. Begin each with /. If a URL inside a disallowed path should remain accessible, enter its more specific path in Allow paths.
  3. Add the full URL of your XML sitemap if one is available. Click Generate robots.txt and compare the displayed rules with your saved copy. Keep tools, assets and crawler groups you still need.
  4. Use Download TXT and publish the reviewed file at the root of the target host as robots.txt. Open the public file and check that it shows your rules as plain text.

Worked example for an internal search area

A site has search results under /search/ and public search instructions under /search/help/. Enter * for the user agent, /search/ in Disallow paths, /search/help/ in Allow paths and https://example.com/sitemap.xml in the sitemap field. The generator produces these rules.

User-agent: *
Allow: /search/help/
Disallow: /search/

Sitemap: https://example.com/sitemap.xml

Google uses the longer matching path, so the help area remains crawlable. Check one URL under each path and one unrelated public page before replacing your live file.

Common mistakes

  • Leaving a staging block in production. A Disallow: / affects the whole host for the selected crawler. Review the file against pages you want crawled.
  • Using crawl rules for private content. Require authentication for private files. For a public page you want excluded from search, let the crawler reach its noindex directive.
  • Applying rules to the wrong host. Check www and non-www hosts separately if both serve pages. Publish each file where its own pages are served.

After publishing, run a site report in SEO Workbench to check whether the public robots.txt and sitemap are reachable.

FAQ

Where should I publish robots.txt?
Put it at the site root, such as https://example.com/robots.txt. Its rules apply to the scheme, host and port that serve that file.
What does an empty Disallow line mean?
It places no crawl restriction on the selected crawler. Supply a path when you intend to restrict a section.
Can a disallowed URL still appear in Google?
Yes. Google can discover a URL through links and list it when it cannot crawl the page. For a public page you want excluded, allow crawling of its noindex directive.
Should I paste a full URL into Allow or Disallow?
Enter the path starting with a slash. Use a full URL in the sitemap field.
How do I apply rules for multiple user agents?
Generate each group in turn. Review and combine the groups into one file, then test which group each crawler uses.

Found it useful? Put a link in your docs, README or forum answer so others can use it too:

HTML
<a href="https://headsntail.com/tools/robots-txt-generator">robots.txt Generator</a> (free, by HeadsNTail)
Markdown (GitHub, Stack Overflow, dev.to)
[robots.txt Generator](https://headsntail.com/tools/robots-txt-generator)

Need a website, HR or business system? HeadsNTail builds websites, HR and payroll apps and business tools. See services or ask a question.