You can write a perfect robots.txt file and still get no benefit from it, because crawlers look for the file in exactly one place. If it is not there, under the exact name they expect, the site is treated as having no robots.txt at all, and every path is crawlable by default. Placement is not a detail of the format; it is most of the format.

This guide covers the location rule, the name, the per-subdomain rule and the plain text format, using the free Robots.txt Generator on Ovatly, which produces the plain text file you place at the root of your domain. It also covers what correct placement cannot fix, so you know where this file's power ends.

Contents

  • Quick answer
  • The one address crawlers check
  • What root of the host means in practice
  • Every subdomain needs its own file
  • The name and the plain text format
  • How to create and place the file, step by step
  • Worked example: one file, one address
  • Limitations: what correct placement cannot fix
  • Common mistakes
  • FAQs
  • Conclusion

Quick answer

The file goes at the root of the host: for example.com, it must be reachable at https://example.com/robots.txt. It is named exactly robots.txt and it is a plain text file built from rule groups. Each subdomain needs its own file at its own root. Build it with the Robots.txt Generator, test it with the Robots.txt Tester, then upload it to that one address.

The one address crawlers check

A crawler arriving at a site asks for the robots.txt file before it starts fetching pages, and it asks at a fixed address: the root of the host, followed by the filename. For a site on example.com, that address is https://example.com/robots.txt. There is no setting that points crawlers to a different location, and no second address they try when the first one fails.

This is why the generator's instruction is phrased the way it is: the tool produces the plain text file you place at the root of your domain. The building and the placing are two halves of the same job. A file that stays in your downloads folder, or sits in a subfolder of the site, is not a robots.txt file in any sense a crawler recognises.

What root of the host means in practice

Root means the top level of the host, the same level as the homepage address itself. If your homepage is at https://example.com/, the file belongs beside it at https://example.com/robots.txt. It does not belong at https://example.com/blog/robots.txt, even if the blog is the part of the site you care about: a file at that address governs nothing, because crawlers never look there.

The practical test is simple. Type the address into a browser. If you see your rules as plain text, the file is where crawlers will find it. If you see a not-found page, or a formatted web page wrapping the text, something is wrong with the placement or the file. Run this check after every upload, because content management systems and hosting panels occasionally move files, rename them or serve a placeholder at the address instead.

Every subdomain needs its own file

Hosts are treated separately, and subdomains are separate hosts for this purpose. The file at https://example.com/robots.txt governs example.com only. A shop at shop.example.com and a staging copy at staging.example.com each need their own file at their own root if you want rules to apply there.

This cuts in two directions. Rules you rely on for the main site silently stop applying on a subdomain, which is how staging content ends up crawlable. And a restrictive file on one subdomain does not protect or harm the others. When you launch or change any subdomain, add its robots.txt to the checklist: build the rules it needs, test them, and place the file at that subdomain's root.

The name and the plain text format

The name is fixed: robots.txt. Not robots-text.txt, not a page slug, and not a setting inside another file. The format is plain text, with no markup and no formatting applied by a word processor. If a tool saves the file with rich formatting or a different extension, what reaches the server is not a readable robots.txt.

Inside, the text is organised as rule groups. Each group names the crawlers it applies to on a User-agent line, using * for all crawlers, then lists the paths those crawlers may not fetch on Disallow lines and any paths reopened on Allow lines, one per line. A group can carry an optional crawl-delay, and the file can list your sitemap addresses on Sitemap lines. That is the whole structure: a handful of labelled lines, which is why a generator that assembles the groups visually is a safer way to produce the file than typing it from memory.

How to create and place the file, step by step

  1. Open the Robots.txt Generator. In the first group, list the user agents the rules apply to, using * for all crawlers.
  2. Add Disallow paths to block and Allow paths to reopen parts of a blocked section, one per line.
  3. Add another group if one crawler needs different rules.
  4. Add your sitemap URL, then copy or download the generated robots.txt.
  5. Test the result with the Robots.txt Tester, using the generated content and a few real paths from your site.
  6. Upload the file to the root of the host, so it answers at https://your-domain/robots.txt, then open that address in a browser to confirm the plain text is served. Repeat for each subdomain that needs rules.

Worked example: one file, one address

The generator's worked example builds this file from a single group, user agent *, blocking an admin area and a temporary folder, with the sitemap listed:

User-agent: *
Disallow: /admin/
Disallow: /tmp/

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

For that file to do its job on example.com, it has to be served at exactly https://example.com/robots.txt. Placed there, a crawler reads it before crawling, skips /admin/ and /tmp/, and learns where the sitemap lives. Placed at https://example.com/files/robots.txt instead, the same flawless content is invisible, and the crawler fetches the admin area like any other path. The content never changed; only the address did.

Limitations: what correct placement cannot fix

Placement decides whether the file is read, not whether it is obeyed in the way you hope. Robots.txt controls crawling, not indexing or security: a disallowed page can still appear in search results if other sites link to it, and anyone can read the file, so never list secret paths in it. It also cannot remove a page from Google; blocking an already indexed page usually keeps the URL in results without a snippet, and deindexing calls for a noindex tag or removing the page. Even its supported extras are uneven: crawl-delay is honoured by some crawlers, for example Bing, but ignored by Googlebot. A perfectly placed file with the wrong expectations still disappoints.

Common mistakes

  • Uploading the file to a subfolder, where no crawler ever looks for it.
  • Saving it under a different name or with rich text formatting, so the address serves something other than a plain text robots.txt.
  • Writing one file for the whole domain family, when each subdomain needs its own file at its own root.
  • Skipping the address check after upload, so a placeholder or error page at /robots.txt goes unnoticed.
  • Listing secret paths in a correctly placed file, which publishes them to anyone who opens that very public address.

FAQs

Where exactly does the robots.txt file go? At the root of the host. For a site on example.com, the file must be reachable at https://example.com/robots.txt. A copy inside a subfolder is not read as the site's robots.txt.

Does every subdomain need its own robots.txt file? Yes. The file must live at the root of the host, for example https://example.com/robots.txt, and each subdomain needs its own file.

What format is a robots.txt file? Plain text. The file is built from rule groups: each group names the crawlers it applies to, then lists Disallow and Allow paths, with an optional crawl-delay and your sitemap addresses.

What is the difference between Allow and Disallow? Disallow tells crawlers not to fetch paths under a prefix; Allow reopens a more specific path inside a disallowed area. When both match, the longest pattern wins.

How do I test the file before uploading it? Use the Robots.txt Tester on this site with the generated content and a few real paths from your site, especially anything you meant to keep crawlable.

Conclusion

Robots.txt has one home: the root of the host, under its own name, as plain text. Get the address right, give every subdomain its own file, and verify the address in a browser after uploading. The Robots.txt Generator handles the content; the placing is yours. For the errors that do the damage once the file is live, see Robots.txt Mistakes That Block Your Whole Site by Accident. For more on keeping crawlers and search engines reading your site correctly, browse the guides in the SEO Tools category.