Add llms.txt to Shopify — 3 paths, ranked by safety
Shopify won't let you serve arbitrary files from the domain root. That makes the standard llms.txt install path impossible by default — but there are three working alternatives. This post ranks the URL Redirects path, the Cloudflare Worker path, and the theme.liquid render path by safety, time-to-deploy, and what each one breaks if you do it wrong.
Add llms.txt to Shopify — 3 paths, ranked by safety
Shopify is the platform where the standard llms.txt install path — drop the file at your domain root, done — doesn't work. The Shopify storefront serves files from the Files CDN at a path like cdn.shopify.com/s/files/..., not from yourdomain.com/llms.txt. Lighthouse Agentic Browsing's llms-txt-present audit checks for the file at the root, not on the CDN, so a raw upload to Shopify's Files CDN passes the upload step but fails the audit.
Three working paths exist. They differ in safety (what's at risk if you do it wrong), time-to-deploy (5 minutes vs 30 minutes), and ongoing maintenance burden. This post walks each one and tells you which is right for which kind of Shopify store.
Path 1 — URL Redirects (safest, easiest, what most stores should use)
Right for: almost every Shopify store. Time: 5 minutes. Risk: low — URL Redirects is a built-in feature that doesn't touch your theme code or your DNS.
- Upload your
llms.txtto Shopify's Files CDN: Shopify admin → Content → Files → Upload files → select yourllms.txt. Once uploaded, copy the file's CDN URL (right-click → Copy link, or use the copy icon). It looks likehttps://cdn.shopify.com/s/files/1/0123/4567/files/llms.txt?v=1234567890. - Shopify admin → Online Store → Navigation → URL Redirects (bottom of the page) → Create URL redirect.
- Redirect from:
/llms.txt(with the leading slash). - Redirect to: paste the full CDN URL from step 1.
- Save.
Verify with curl -sL https://yourdomain.com/llms.txt — the -L follows the 301 redirect. You should see the file content. Lighthouse follows redirects too, so the audit passes.
The one catch. Shopify's URL Redirects serve a 301 to the CDN URL — most Lighthouse agents follow this fine, but some strict crawlers (specifically the ones that disallow cross-origin redirects for security reasons) won't follow a redirect from your custom domain to cdn.shopify.com. In practice this hasn't been a problem for any agent crawler we've seen in 2026, but it's the theoretical-edge-case asterisk.
Same pattern works for agents.json and agent-instructions.md — three separate redirects, one per file. The Shopify install guide walks all three.
Path 2 — Cloudflare Worker (most reliable, slightly more work)
Right for: Shopify stores that already have Cloudflare in front (or are willing to add it). Time: 20-30 minutes including Cloudflare setup if not already configured. Risk: medium — DNS migration if Cloudflare isn't already there.
Cloudflare can sit in front of your Shopify domain and serve /llms.txt directly from a Worker — no redirect, the file responds from your custom domain with the correct Content-Type: text/plain. This is the highest-fidelity install: the audit sees the file at the exact path, no cross-origin redirect, no CDN URL leakage in the response.
- Add your domain to Cloudflare (Cloudflare dashboard → Add site). Update your registrar's nameservers to Cloudflare's. This is the DNS migration step — wait for propagation before continuing (usually 5-30 minutes, occasionally hours).
- In Cloudflare → Workers & Pages → Create Worker. Name it
agentic-kit-files. - Paste this Worker code:
const files = {
'/llms.txt': { type: 'text/plain', body: `<<paste llms.txt content here>>` },
'/agents.json': { type: 'application/json', body: `<<paste agents.json>>` },
'/agent-instructions.md': { type: 'text/markdown', body: `<<paste runbook>>` }
};
export default {
async fetch(request) {
const url = new URL(request.url);
const file = files[url.pathname];
if (!file) return fetch(request);
return new Response(file.body, {
headers: { 'Content-Type': file.type, 'Cache-Control': 'public, max-age=3600' }
});
}
};
- Save and deploy.
- Cloudflare → Workers Routes → add three routes:
yourdomain.com/llms.txt,yourdomain.com/agents.json,yourdomain.com/agent-instructions.md. Each points at theagentic-kit-filesWorker.
Now https://yourdomain.com/llms.txt returns your file directly with the correct content type, and all other paths pass through to Shopify untouched.
The migration gotcha. When you switch nameservers to Cloudflare, make sure your MX records (email) and any other DNS records (subdomains, verification TXT records for Google Search Console, Apple Pay merchant verification) come along with you. The Cloudflare onboarding scans your existing zone and offers to import most of it; double-check the MX records specifically before you flip the nameservers, because losing email is a worse problem than not having llms.txt.
This is also the path that fixes auto-discovery-links — you can have the Worker inject the three <link rel="alternate"> tags into your Shopify homepage <head> via response rewriting, without editing theme.liquid. The Cloudflare and Shopify checklists cover that flow.
Path 3 — theme.liquid rendering (clever, but fragile)
Right for: Shopify developers who already maintain a custom theme and want to keep everything inside the theme. Time: 15 minutes. Risk: medium-high — theme edits get clobbered by Shopify theme updates if not done in an unpublished duplicate.
You can render /llms.txt from a Liquid template by creating a "page" with the URL handle llms-txt and overriding the page.llms-txt.liquid template to output text/plain. The audit sees the file at the root.
The catch: Shopify URLs always namespace pages under /pages/, so /pages/llms-txt works but /llms.txt doesn't. The fix is to combine this with a URL redirect from /llms.txt to /pages/llms-txt, which is Path 1 with extra steps and a worse outcome — the redirect lands on a Liquid-rendered page that adds extra HTML around your content unless you override the layout entirely.
In practice, Path 3 always loses to Path 1 or Path 2. It exists as a theoretical option for theme developers who want to keep file content in version-controlled Liquid templates — but the maintenance burden (theme updates, template overrides, redirect coupling) doesn't pay off against the simplicity of Path 1 or the reliability of Path 2.
Which path for which store
| Store profile | Right path | Why |
|---|---|---|
| Standalone Shopify, no Cloudflare | Path 1 (URL Redirects) | 5 min, no infra to add |
| Shopify already behind Cloudflare | Path 2 (Worker) | Highest fidelity, no redirect |
| Shopify with custom theme + dev team | Path 1, not Path 3 | Path 3 is fragile against theme updates |
| Multi-store / Shopify Plus | Path 2 | Worker scales across stores; URL Redirects don't |
Whatever path you pick, verify with the same curl command afterward: curl -sL https://yourdomain.com/llms.txt. If the response body is your file content and the response headers (visible with -I) show content-type: text/plain, you're done.
The Lighthouse per-audit fix reference covers what to do if any of the other eight Lighthouse Agentic Browsing audits also fail on your Shopify store. The two related audits — llms-txt-well-formed (file content validates against the spec) and auto-discovery-links (the three <head> tags) — usually need to be closed alongside llms-txt-present to get a clean audit pass.
Related
- UCP and Shopify: what's native vs what the kit adds → — Verify-your-store-already-has-it walkthrough plus what UCP doesn't cover.
- The 2026 agent-ready Shopify checklist — beyond Agentic Storefronts → — the full four-surface model for making a Shopify store agent-ready
- Install your Agentic Kit on Shopify → — step-by-step kit install (all three files, with the redirect setup walked through)
- Lighthouse Agentic Browsing — every audit, every fix → — the per-audit fix reference
- Shopify Agentic Storefronts — what it means for your AI-readiness strategy → — the May 25 terms update and what Agentic Storefronts covers
- llms.txt reference → — the file's shape and content rules
- Agentic Kit install matrix → — install paths across all 13 supported platforms
- Run the free readiness audit → — five-second check on your Shopify store