Robots.txt for WordPress & Shopify: The 2026 Perfect-Setup Guide
WordPress and Shopify power roughly half the web, and they handle robots.txt in completely opposite ways, which is exactly where people get stuck. On WordPress you're editing a file (or a plugin's version of one, and they fight). On Shopify there is no file to edit; you edit a Liquid template that generates it on every request, so a "normal" robots.txt upload silently does nothing. Get the platform's model right and the rest is copy-paste. Get it wrong and you'll swear your edits aren't saving. This guide covers both models and the exact rules for each.
Quick verdict: WordPress: edit via Yoast/Rank Math OR a physical file at the root, never both (they override each other). Shopify: there's no static file, edit the robots.txt.liquid theme template. Both should add AI-bot blocks if you're opting out of training, plus a Sitemap directive. Use our free generator with the platform preset for a copy-paste-ready file.
What WordPress's Default Robots.txt Actually Says
If your WordPress site has no physical robots.txt file, WordPress generates one virtually. The default looks like this:
User-agent: *
Disallow: /wp-admin/
Allow: /wp-admin/admin-ajax.php
That's it. It blocks the admin area but allows the AJAX endpoint (which needs to be accessible for many plugins). It does NOT include:
- A sitemap reference
- AI training bot blocks
- Login or registration page blocks
- XML-RPC or REST API blocks
- Internal search or pagination blocks
- Comment author URL blocks
For most production WordPress sites, this is insufficient. The improved version follows.
Recommended WordPress Robots.txt (Copy-Paste)
# === AI Training Crawlers (block to opt out) ===
User-agent: GPTBot
Disallow: /
User-agent: ClaudeBot
Disallow: /
User-agent: Google-Extended
Disallow: /
User-agent: PerplexityBot
Disallow: /
User-agent: CCBot
Disallow: /
# === All other bots ===
User-agent: *
# Block admin and login
Disallow: /wp-admin/
Disallow: /wp-login.php
Disallow: /wp-register.php
Allow: /wp-admin/admin-ajax.php
# Block system paths
Disallow: /wp-includes/
Disallow: /wp-content/plugins/
Disallow: /wp-content/cache/
Disallow: /xmlrpc.php
# Block internal search and pagination noise
Disallow: /?s=
Disallow: /search/
Disallow: /*?replytocom=
Disallow: /comments/feed/
# Block trackbacks
Disallow: /trackback/
Disallow: /*/trackback/
# Allow important assets
Allow: /wp-content/uploads/
Allow: /*.css$
Allow: /*.js$
# === Sitemaps ===
Sitemap: https://yoursite.com/sitemap.xml
Sitemap: https://yoursite.com/sitemap_index.xml
Replace yoursite.com with your actual domain. The two sitemap entries cover both standard sitemaps and Yoast/RankMath sitemap indexes — include whichever matches your setup.
How to Install Custom Robots.txt on WordPress
Method 1: Yoast SEO (most common)
- Yoast SEO → Tools → File Editor
- If no robots.txt exists, click "Create robots.txt file"
- Paste the recommended content from the previous section
- Save changes
- Verify by visiting
yoursite.com/robots.txt
Method 2: Rank Math
- Rank Math → General Settings → Edit robots.txt
- Paste content, save
- Rank Math will replace WordPress's virtual file
Method 3: Manual upload (FTP / file manager)
- Save the recommended content as
robots.txtin a plain text editor (VS Code, Sublime, or Notepad++ — not Word) - Connect to your WordPress install via FTP or your host's file manager
- Upload to the same level as
wp-config.php(the WordPress root) - Visit
yoursite.com/robots.txtto verify — it should show your custom content, not the virtual default
The physical file takes precedence over the virtual one automatically — no additional configuration needed.
Method 4: Code snippet plugin (advanced)
For programmatic control, use a plugin like Code Snippets and add:
add_filter('robots_txt', function($output) {
return "User-agent: GPTBot\nDisallow: /\n\n" . $output;
}, 10);
This prepends your custom rules to whatever WordPress generates dynamically. Useful if you want WordPress's defaults plus a few extras.
What Shopify's Default Robots.txt Includes
Shopify's auto-generated robots.txt is more comprehensive than WordPress's. It includes blocks for cart, checkout, accounts, search, policies, and Shopify-internal paths. The default also includes a sitemap reference automatically.
Sample Shopify default (paths vary slightly by store config):
User-agent: *
Disallow: /admin
Disallow: /cart
Disallow: /orders
Disallow: /checkouts/
Disallow: /carts
Disallow: /account
Disallow: /collections/*sort_by*
Disallow: /*/collections/*sort_by*
Disallow: /collections/*+*
Disallow: /collections/*%2B*
Disallow: /collections/*%2b*
Disallow: /blogs/*+*
Disallow: /blogs/*%2B*
Disallow: /blogs/*%2b*
Disallow: /*?q=
Disallow: /policies/
Disallow: /search
Disallow: /apple-app-site-association
Sitemap: https://yourstore.myshopify.com/sitemap.xml
This is solid for the basics — better than WordPress's default. What it lacks: AI bot blocks, custom collection or tag blocks, and any store-specific cleanup rules.
Recommended Shopify Robots.txt Additions
You don't replace Shopify's default — you append to it via the robots.txt.liquid template. The full template should look like this:
{% raw %}{%- for group in robots.default_groups -%}
{{- group.user_agent }}
{%- for rule in group.rules -%}
{{ rule }}
{%- endfor -%}
{%- if group.sitemap != blank -%}
{{ group.sitemap }}
{%- endif -%}
{%- endfor -%}{% endraw %}
# === Custom additions ===
# Block AI training crawlers
User-agent: GPTBot
Disallow: /
User-agent: ClaudeBot
Disallow: /
User-agent: Google-Extended
Disallow: /
User-agent: PerplexityBot
Disallow: /
User-agent: CCBot
Disallow: /
# Block filtered URLs (duplicate content)
User-agent: *
Disallow: /*?filter=
Disallow: /*?color=
Disallow: /*?size=
Disallow: /*?pf_
# Block /collections/all (large duplicate index)
User-agent: *
Disallow: /collections/all
The Liquid template at the top preserves Shopify's defaults; your custom rules are appended after.
How to Install Custom Robots.txt on Shopify
- Admin → Online Store → Themes
- Click the ⋯ menu on your live theme → Edit code
- Templates folder → Add a new template
- Choose "robots" from the dropdown — Shopify creates a
robots.txt.liquidfile with the default content already populated - Modify the file to add your custom rules (see the recommended template above)
- Save — Shopify regenerates robots.txt immediately
- Verify by visiting
yourstore.com/robots.txt
WordPress vs Shopify: Robots.txt Comparison
| Feature | WordPress | Shopify |
|---|---|---|
| Default file | Minimal (only /wp-admin/) | Comprehensive |
| Customization method | Plugin or FTP upload | robots.txt.liquid template |
| Sitemap auto-included | No (default) | Yes |
| AI bot blocks included | No | No |
| Easy to break | Moderate (one bad upload can block site) | Low (Liquid template usually fails safely) |
| Validation tools | Search Console + plugin previews | Search Console + Shopify admin preview |
| Best plugin/method | Yoast SEO or Rank Math | Native robots.txt.liquid |
Other Platforms (Quick Reference)
| Platform | Where to edit robots.txt |
|---|---|
| Wix | Settings → SEO → Advanced → Robots.txt (Business/Premium plans) |
| Squarespace | Limited — can append via Settings → Advanced → Code Injection |
| Webflow | Project Settings → SEO → Robots.txt |
| Ghost | Edit /content/files/robots.txt or use a custom routes.yaml |
| Vercel / Next.js | Place robots.txt in /public/ folder |
| Netlify | Place robots.txt in your build output folder |
| Hugo / Jekyll / static | Place in /static/ or /assets/ folder; it gets copied to build output |
Verify Your Setup Works
- Visit
yoursite.com/robots.txtin a private browser window. You should see your custom content. - Open Google Search Console → Settings → Robots.txt. Click "Request a recrawl" to force Google to fetch the new version.
- Use URL Inspection on a few URLs to test:
- An admin URL — should show "blocked"
- A normal blog/product URL — should show "allowed"
- An AI training crawler test — not testable in Search Console, but verify the syntax in your file
- Wait 2-3 days for crawlers to refresh their cached version.
- Monitor Coverage report in Search Console for the next 2 weeks. "Blocked by robots.txt" entries should match your intent.
The robots.txt bug I see most when a client moves between platforms: they carry over the mental model along with the content. A team that ran WordPress for years migrates to Shopify, edits a robots.txt the way they always did, confirms the file "looks right," and three weeks later half their collection pages are missing from Google because their actual changes never took, Shopify rebuilt the file from its template and ignored their upload. The reverse happens too: Shopify-native teams move to WordPress and assume they need a theme template. My rule when auditing any site now is to identify the platform's robots.txt model first, before reading a single rule, because a perfectly written ruleset applied through the wrong mechanism is just a file nobody is serving. The rules matter less than knowing which door they go through.
Frequently Asked Questions
Get the platform model right first
WordPress's default robots.txt is too minimal; Shopify's is solid but missing AI-bot blocks. The recommended setup for both adds training-bot opt-outs, a sitemap directive, and platform-specific path blocks. But the step that prevents the silent failure is identifying the platform's model before you write a single rule: WordPress serves a file (don't run a plugin editor and a physical file at once), Shopify generates one from a Liquid template (a static upload does nothing). Use our generator with the platform preset for a tested, copy-paste-ready file, then install it the way that platform actually reads.
