Skip to content
SearchLearningToolsSEO & GEO
Back to guides

How to Create a Robots.txt File (Free Generator + Templates for Every Platform)

7 min read•Beginner to Intermediate•Published Nov 27, 2026•Last updated Nov 27, 2026•By SearchLearningTools Team• Production-Tested
2-Minute Action Step: Test This In Real-Time

Put this guide into practice with our free companion browser tools.

100% free, client-side private, and zero sign-up required. Run keyword clustering, schema generation, or SERP previews in seconds.

Launch Free Tools →
Robots.txt file example showing the default preview with GPTBot, Claude-SearchBot and PerplexityBot disallowed
The default preview: GPTBot, Claude-SearchBot and PerplexityBot disallowed.Try the robots.txt generator →

A robots.txt file is a plain-text file at the root of your site that tells search crawlers which parts of the site they may visit. You can create one in about a minute with a free generator, then upload it to your domain root and check it works. Below: the generator, templates for every platform, and the verification flow.

Create your robots.txt file in about a minute

The fastest route is the robots.txt generator. It builds an RFC 9309-compliant file from a few choices, free with no signup, and shows a live preview as you change the settings.

How to use the robots.txt generator

The generator page has four controls: a CMS / Framework Preset selector (presets include WordPress and Next.js, per the page's description), an XML Sitemap Location field, toggles for Googlebot and Bingbot, and toggles for AI bots (GPTBot, Claude-SearchBot and PerplexityBot). Enter your sitemap URL and the preview adds a Sitemap: line with that address.

In the default preview, the wildcard group allows all crawling; GPTBot, Claude-SearchBot and PerplexityBot are disallowed. The page also shows a worked example for a Next.js App Router deployment, where /api/ is blocked, GPTBot is disallowed, and Claude-SearchBot and PerplexityBot are allowed so the site can still appear in AI answers with citations. The file follows RFC 9309, the 2022 Robots Exclusion Protocol standard: case-sensitive path matching, prefix matching, longest-match precedence, and a 500 KiB maximum file size.

The 6-step creation flow

  1. Decide what to block. Block low-value paths: admin areas, login pages, cart and checkout, internal search results, filtered listings, thank-you pages, and staging copies. Keep CSS, JavaScript and images open.
  2. Generate or write the file. Use the generator, or copy a template below and edit the paths and sitemap URL.
  3. Save it as plain text, UTF-8. The file must be named exactly robots.txt, all lowercase.
  4. Upload it to the domain root. It must live at https://yourdomain.com/robots.txt; crawlers do not check subdirectories. One file covers one protocol, host and port, so subdomains need their own files.
  5. Verify it. Open the live URL, run a checker, and check the robots.txt report in Search Console.
  6. Recheck after changes. Re-test after every migration, redesign, plugin change or edit — Google caches robots.txt for about 24 hours.

Copy-paste templates

Allow everything

User-agent: *
Allow: /

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

WordPress

User-agent: *
Disallow: /wp-admin/
Allow: /wp-admin/admin-ajax.php
Disallow: /readme.html
Disallow: /?s=

Sitemap: https://yourdomain.com/sitemap_index.xml

The Allow: /wp-admin/admin-ajax.php line matters: WordPress uses that file for front-end features. Do not block /wp-content/ or /wp-includes/.

Next.js

User-agent: *
Allow: /
Disallow: /api/

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

Shopify

Shopify generates a robots.txt file automatically — edit robots.txt.liquid in your theme to change it, adding Disallow: lines such as /search and /checkout.

Ecommerce store

User-agent: *
Allow: /
Disallow: /cart/
Disallow: /checkout/
Disallow: /account/
Disallow: /*?sort=
Disallow: /*?filter=

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

Cart, checkout and account pages have no search value. The wildcard lines block sorted and filtered listings.

Blog or SaaS site

User-agent: *
Allow: /
Disallow: /search/
Disallow: /login/
Disallow: /app/
Disallow: /dashboard/

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

For a blog, the key line is /search/ — internal search-result pages are thin duplicates. For SaaS, keep the logged-in app closed.

Staging site

User-agent: *
Disallow: /

Use this only on staging copies, and remove it before launch.

Block AI training, stay visible in AI answers

Training crawlers collect content to train models; search crawlers fetch pages to cite them. Block the first group while leaving the second open — a block no competing guide offers:

User-agent: GPTBot
Disallow: /

User-agent: ClaudeBot
Disallow: /

User-agent: CCBot
Disallow: /

User-agent: Google-Extended
Disallow: /

User-agent: Bytespider
Disallow: /

User-agent: OAI-SearchBot
Allow: /

User-agent: Claude-SearchBot
Allow: /

User-agent: PerplexityBot
Allow: /

Google-Extended is not a crawler; it is a token controlling whether Google may use your content for AI training. Training bots do not send visitors, so blocking them costs nothing. Search bots fetch the page to cite it, so blocking them costs visibility in AI answers.

Where to put the file on each platform

  • WordPress. Edit robots.txt inside an SEO plugin such as Yoast or Rank Math, or upload it by FTP to the root folder. First check Settings → Reading: if "Discourage search engines from indexing this site" is ticked, WordPress injects a Disallow: / that overrides your file.
  • Next.js. Place the file in the public/ folder, or create app/robots.ts to generate it from code.
  • Shopify. Edit robots.txt.liquid in the theme. There is no file to upload.
  • Wix, Squarespace and Webflow. Each has a built-in robots.txt editor in its SEO settings.
  • Plain HTML or static hosting. Upload the file by FTP or your host's file manager to the root.

How to verify your robots.txt file

Several ranking guides still point readers to Google's retired interactive robots.txt Tester. Use this flow instead:

  1. Open the live URL. Visit https://yourdomain.com/robots.txt — you should see your file, not a 404 or an old version.
  2. Run a checker. Test specific URLs and user-agents: confirm /checkout/ is blocked and a CSS file is allowed. The generator page suggests a checker simulating Googlebot, GPTBot and PerplexityBot.
  3. Check the Search Console robots.txt report. It shows the file Google last fetched, when it fetched it, and any errors — the current replacement for the retired Tester.
  4. Confirm key pages, CSS and JavaScript are still crawlable. Use the URL inspection tool in Search Console to check that a real page renders fully.
  5. Recheck after changes. Any edit, migration or redesign means running steps 1–4 again. Remember the roughly 24-hour cache.

A 404 means no robots.txt exists. A 5xx error means Google pauses crawling. A file larger than 500 KiB is cut off at the limit.

Mistakes checklist

  • Staging `Disallow: /` left live. Remove it before launch, then verify the live file.
  • Wrong filename or location. The file must be robots.txt, lowercase, at the domain root.
  • Blocking CSS or JavaScript. Search engines need them to render pages — never disallow their folders.
  • Missing trailing slash. Disallow: /private blocks /private-page too. Use Disallow: /private/.
  • Empty Disallow misunderstood. Disallow: with nothing after it means "allow everything". Disallow: / means "block everything".
  • Relying on robots.txt to remove pages from search. It only blocks crawling; it does not remove URLs from the index. To remove a page, use a noindex tag.
  • Using a `Noindex:` line in robots.txt. Google does not support it — dropped in 2019. Use a noindex meta tag or header instead.
  • Adding Crawl-delay for Google. Google ignores Crawl-delay. It works only for some other crawlers.
  • Treating robots.txt as security. The file is public — anyone can open it. Never list sensitive paths in it. Passwords protect content.
  • Noindex and Disallow on the same page. If robots.txt blocks a page, crawlers never see its noindex tag. Pick one method.
  • Forgetting subdomains and protocols. One file covers one protocol, host and port — www and non-www need separate files.
  • Stale sitemap line. If the sitemap URL no longer exists, crawlers follow a dead link.
SL

Search Learning Tools Editorial Team

• Lead Search Practitioner

Specializing in Technical SEO architecture, Generative Engine Optimization (GEO), and Schema.org structured data. Audits search retrieval models and entity attribution.

Author verification: Published on Search Learning Tools • Contact via Editorial Team

Found this helpful? Share it:

Share on Twitter

Turn the lesson into a workflow

The free guide explains the reasoning. Use the prompt generator to create a starting point for your next research, briefing, or optimization task.

Try the free AI SEO prompt generator

Common questions

Use a free generator, or write it in a plain-text editor as `robots.txt` in UTF-8. Upload it to the domain root so it is served at `https://yourdomain.com/robots.txt`, then check the live URL.

It must live at the domain root — crawlers will not check subdirectories. On WordPress, use an SEO plugin or FTP; on Next.js, use the `public/` folder; on Shopify, edit `robots.txt.liquid`.

No. Robots.txt only blocks crawling — it does not remove a URL from the index, so a blocked page can still appear in search results. To remove a page, use a noindex tag.

Yes. Add a `User-agent:` group for each crawler — GPTBot, ClaudeBot, CCBot, Google-Extended or Bytespider — with `Disallow: /`. To stay visible in AI answers, leave OAI-SearchBot, Claude-SearchBot and PerplexityBot allowed.

Open the live URL, run a checker against specific URLs and user-agents, and check the robots.txt report in Google Search Console. The old Tester was retired — the report is the current check.

Not always. If no pages need to stay out of the crawl, search engines will crawl the site without one. A file is worth having for admin areas, login and checkout pages, internal search results, filtered listings or a staging copy.

Corner 6 of 6 • Full-Stack Technical Telemetry 3-6-9 Law of Trust Verified

Canonical Trust & Verification Matrix: Common questions

Canonical Topic Definition (HTTP Status, Canonical Integrity & SERP Pixel Width Verification)

Full-Stack Technical Telemetry audits live HTTP 200 responses, 301/308 redirect hops, self-referencing canonical tags, single H1 hierarchy, and HTML5 Canvas Arial 20px SERP title widths (≤580px desktop) to eliminate indexing friction.

Deterministic Formula:Indexability_Health = HTTP_200 ∧ (Canonical == Self_URL) ∧ (H1_Count == 1) ∧ (Title_Canvas_Px <= 580)
3-6-9 Law of Trust Verification Matrix for Common questions across Google Search (Corner 3), Human Users (Corner 6), and AI Answer Engines (Corner 9).
3-6-9 Trust CornerTrust Issue ResolvedSearchLearningTools Canonical StandardDeterministic Verification Proof
Corner 3 • Google SearchEliminates scaled fluff, hidden DOM FAQs, redirect chains & fabricated review stars40–60w Answer-First blocks, 100% visible SSR parity & self-referencing canonical URLHTTP 200 ∧ Canonical == Self ∧ 0 Fake Ratings
Corner 6 • Human UsersEliminates bait-and-switch paywalls, mandatory signups & opaque black-box scoresZero login walls, client-side privacy & connected workflow: Website SEO Auditor → URL Redirect Checker0 Bytes Stored • Open Formula • CSV/Copy Ready
Corner 9 • AI Engines (RAG)Eliminates high-perplexity narrative walls, blocked search bots & unverified statsSemantic HTML Trust Matrix (<th scope="col/row">), RFC 9309 bot allow & /llms-full.txtAllow(OAI, Perplexity, Claude) • CC BY 4.0

Community Q&A

Questions and answers for this guide

Ask a question or leave a quick review

Maya

Sep 12, 2026

The keyword clustering prompts are clear, and the workflow helps me explain the why behind each content brief.

Leo

Sep 14, 2026

I used the AI visibility checklist before publishing a guide and it caught a few gaps around direct-answer structure and heading clarity.

Free SEO tools and guides

Try a relevant tool while you work through this guide.