People often search for "the right robots.txt for WordPress" or "a Shopify robots.txt" as if each platform had its own format to learn. It does not. A robots.txt file is one plain text format everywhere: a set of rule groups that tell crawlers which paths they may not fetch. What changes from site to site is simply which paths you list, because a WordPress admin area, a shop checkout and a hand-built site's temporary folder live at different addresses.
This guide walks through worked examples for the three situations, all built from the same directives and assembled with the free Robots.txt Generator on Ovatly. The examples are patterns to adapt to your own paths, not copies of any platform's default file. It also repeats the limit that applies everywhere: robots.txt controls crawling, not indexing and not security.
Contents
- Quick answer
- One format for every platform
- The directives these examples use
- Example 1: a plain starting file
- Example 2: a WordPress site
- Example 3: an online shop
- Example 4: a custom site with a crawler-specific group
- How to build any of these, step by step
- Limitations: what robots.txt cannot do
- Common mistakes
- FAQs
- Conclusion
Quick answer
Whatever runs your site, the file is built the same way: one or more rule groups, each starting with a User-agent line naming the crawlers it applies to (* means all of them), followed by Disallow lines for paths those crawlers should not fetch and Allow lines for any specific path inside a blocked area that should stay open. An optional Crawl-delay line and your Sitemap address complete the file, placed at the root of your domain. The examples below differ only in the paths they name. Build yours with the Robots.txt Generator by filling in groups and paths.
One format for every platform
A robots.txt file is made of rule groups. Each group applies to the crawlers named in its User-agent line, and the rules under it are paths. Disallow tells crawlers not to fetch paths under a prefix, so one line covers a whole folder and everything inside it. Allow reopens a more specific path inside a disallowed area, and when both match a path, the longest pattern wins. Groups let you give one crawler different rules from the rest: a group for * covers every crawler, and you add another group when a named crawler needs its own set.
Two more lines appear in most files. Crawl-delay is optional and asks crawlers to pace their requests; it is honoured by some crawlers, for example Bing, but ignored by Googlebot. The Sitemap line simply points crawlers at your sitemap address. The finished file lives at the root of the host, at an address like https://example.com/robots.txt, and each subdomain needs its own file.
The directives these examples use
Every example here uses only five directives: User-agent, Disallow, Allow, Crawl-delay and Sitemap. That small set covers the common jobs: keeping crawlers out of admin and temporary areas, reopening one useful path inside a blocked section, and pointing crawlers at your sitemap.
Example 1: a plain starting file
The simplest useful file blocks an admin area and a temporary folder for every crawler, and lists the sitemap:
User-agent: *
Disallow: /admin/
Disallow: /tmp/
Sitemap: https://example.com/sitemap.xml
This is the shape most sites start from. One group, two blocked prefixes, one sitemap line. The platform examples below are variations on it: same structure, different paths.
Example 2: a WordPress site
A WordPress site has an admin area that crawlers gain nothing from fetching. The pattern is the starting file with the admin path your setup actually uses:
User-agent: *
Disallow: /wp-admin/
Disallow: /tmp/
Sitemap: https://example.com/sitemap.xml
Read this as a pattern, not a default: the WordPress version of the job is still one group and a Disallow line naming the admin path. Check the path against your own site before using it, because the prefix must match the folder you mean to block. If part of the blocked area should stay crawlable, an Allow line naming that more specific path reopens it, because the longest matching pattern wins.
Example 3: an online shop
A shop usually wants crawlers all over its product and category pages, and has no reason to let them spend visits on checkout and account paths. The same pattern, with shop paths:
User-agent: *
Disallow: /checkout/
Disallow: /account/
Sitemap: https://example.com/sitemap.xml
Again, treat the paths as placeholders for your own: shops differ in how their checkout and account areas are addressed, so copy the structure and substitute your store's prefixes. The sitemap line matters here as much as the blocked paths: it points crawlers at the pages you do want fetched.
Example 4: a custom site with a crawler-specific group
A hand-built site gives you full freedom over the file, and the extra feature worth knowing is the second group. Here every crawler is kept out of the admin and temporary folders, and one named crawler gets its own group carrying an optional crawl-delay:
User-agent: *
Disallow: /admin/
Disallow: /tmp/
User-agent: Bingbot
Disallow: /admin/
Disallow: /tmp/
Crawl-delay: 10
Sitemap: https://example.com/sitemap.xml
Two honest notes. A crawl-delay is a request some crawlers honour and others ignore; Googlebot ignores it, so do not rely on it to pace every visitor. And a second group is only worth adding when a crawler genuinely needs different rules; for most sites the single * group from Example 1 is the whole file.
How to build any of these, step by step
- Open the Robots.txt Generator.
- In the first group, list the user agents the rules apply to. Use
*for all crawlers, as every example above does for its main group. - Add the
Disallowpaths to block and anyAllowpaths that reopen part of a blocked section, one per line. These are the only lines that change between the WordPress, shop and custom examples. - Add another group only if one crawler needs different rules, as in Example 4, and set a crawl-delay there if you want one.
- Add your sitemap URL, then copy or download the generated robots.txt and place it at the root of your domain.
Before the file goes live, run it through the Robots.txt Tester with a few real paths from your site, especially anything you meant to keep crawlable. A two-minute test is cheaper than discovering a blocked section later.
Limitations: what robots.txt cannot do
The limits are the same on every platform, because they belong to the format. robots.txt controls crawling, not indexing or security. A disallowed page can still appear in search results if other sites link to it, usually without a snippet. Anyone can read your robots.txt file, so never list secret paths in it; naming a hidden folder advertises it. Blocking is also the wrong tool for removing an indexed page: use a noindex tag or remove the page. Finally, the file only governs the host it sits on, so a subdomain needs its own file.
If your goal is removing pages rather than steering crawlers, the companion guide How to Block a Page or Folder From Search Engines With Robots.txt covers where blocking works and where it is the wrong tool, in more detail.
Common mistakes
- Copying an example file unchanged. The paths in any example belong to someone else's site. The structure transfers; the paths must be yours.
- Blocking a section, then linking the secret. A blocked page that other pages link to can still appear in results without a snippet. Blocking is not hiding.
- Listing private paths for tidiness. The file is public. Every path you name is a path anyone can read about.
- Adding a crawl-delay and assuming all crawlers obey it. Some honour it, Googlebot ignores it. Treat it as a polite request to a few crawlers, nothing more.
- Forgetting the subdomains. A file at your main domain's root says nothing about your subdomains; each needs its own.
FAQs
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.
Does an empty Disallow line matter? "Disallow:" with nothing after it means nothing is blocked for that group. The generator only writes Disallow lines for paths you actually enter.
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.
Can robots.txt remove a page from Google? No. Blocking a page that is already indexed usually keeps the URL in results without a snippet. Use a noindex tag or remove the page for deindexing.
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.
Conclusion
WordPress, a shop platform and a custom site all take the same robots.txt file: rule groups, Disallow and Allow paths, an optional crawl-delay and a sitemap line, placed at the root of the domain. Pick the example closest to your site, replace its paths with your own, test it, and publish. The Robots.txt Generator turns that into a few minutes of form-filling, and the wider SEO Tools guides cover the neighbouring jobs, from sitemaps to testing the finished file.