---
title: How to add an llms.txt file to a WordPress site
description: Step-by-step guide to adding an llms.txt file to WordPress, covering both the manual file-upload and plugin (dynamic) approaches, the Apache and Nginx rewrite gotchas, and validation against the llmstxt.org spec.
last_updated: 2026-06-20
canonical_url: https://agent-ready.dev/how-to-add-llms-txt-to-wordpress
---

# How to add an llms.txt file to a WordPress site

> A step-by-step guide to the manual file-upload path and the plugin (dynamic) path — plus the rewrite-rule gotcha that trips most WordPress sites up.

## What is llms.txt?

llms.txt is a Markdown file served at `/llms.txt` that gives AI systems a curated, plain-text map of a website's most important content. The format was [proposed in late 2024 by Jeremy Howard at Answer.AI](https://llmstxt.org). For a plain-English overview, see [what is llms.txt](https://agent-ready.dev/what-is-llms-txt); this guide is about shipping one on WordPress specifically.

## Where does llms.txt live on a WordPress site?

At the web root, served at `/llms.txt`. The wrinkle is that WordPress is a front controller: it rewrites unknown URLs through `index.php` so they can be resolved as posts and pages. A real file sitting in the root sidesteps that rewrite, because both the default Apache [.htaccess rules](https://wordpress.org/documentation/article/htaccess/) and a standard Nginx `try_files` block serve existing files before falling back to WordPress.

## Step-by-step

### Step 1 — Write your llms.txt content

Create the file content in any plain-text editor. The llmstxt.org spec mandates an H1 with your site name and a one- or two-sentence blockquote summary, then optional ## section headings grouping bullet-point links to your most authoritative pages. Curate to documentation, key product pages, and policies — a short, high-signal index beats an exhaustive sitemap.

### Step 2 — Upload the file to your WordPress root directory

Connect to your site over SFTP or your host's file manager and place llms.txt in the same folder as wp-config.php and the wp-admin / wp-content directories — that is the web root. The file then resolves at https://yoursite.com/llms.txt. Do not put it inside wp-content, a theme folder, or a subdirectory, and do not create a WordPress Page named llms.txt.

### Step 3 — Confirm WordPress serves the file directly

WordPress routes unknown URLs through index.php, so make sure your server hands back the real file instead. On Apache, the default .htaccess rewrite already excludes existing files via RewriteCond %{REQUEST_FILENAME} !-f, so a real llms.txt in the root is served as-is. On Nginx, the standard try_files $uri $uri/ /index.php?$args line serves the file because $uri matches first — but a misconfigured try_files that jumps straight to index.php will 404 inside WordPress.

### Step 4 — Verify it returns text/plain

Send a HEAD request: curl -I https://yoursite.com/llms.txt. You should see HTTP 200 and a Content-Type that includes text/plain. If a caching plugin or CDN returns text/html or a stale body, purge the cache and confirm the CDN passes .txt through as text/plain rather than rewriting it.

### Step 5 — Validate against the llmstxt.org spec

Run your URL through agent-ready.dev/llms-txt-checker to confirm the file passes the 10-check llmstxt.org compliance suite — H1 present, blockquote summary, valid Markdown, correct link format, accessible URLs, proper Content-Type, and the optional llms-full.txt companion. Each failed check comes with a one-line fix.

### Example llms.txt

```markdown
# Acme Cloud Widgets

> Widgets-as-a-service for serverless apps. Deploy in one command.

## Documentation

- [Getting started](https://acme.dev/docs/start): Zero to deployed in 60 seconds
- [API reference](https://acme.dev/docs/api): REST endpoints and authentication
- [SDKs](https://acme.dev/docs/sdks): Official client libraries

## Policies

- [Privacy policy](https://acme.dev/privacy): Data handling and retention
- [Terms of service](https://acme.dev/terms): Usage terms

## Optional

- [Sitemap](https://acme.dev/sitemap.xml)
- [llms-full.txt](https://acme.dev/llms-full.txt): Full content bundle
```

### Rewrite rules — Apache and Nginx

```apache
# Apache — the default WordPress .htaccess already does this:
# requests for files that exist (!-f) and dirs that exist (!-d)
# are served directly, so a real /llms.txt is returned as-is.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# Nginx — try_files serves the real file first, then falls back to WP:
location / {
  try_files $uri $uri/ /index.php?$args;
}
```

### Verify with curl

```bash
curl -I https://yoursite.com/llms.txt

# Expected response:
# HTTP/2 200
# content-type: text/plain; charset=utf-8
```

## How do I generate llms.txt with a plugin?

If you'd rather not maintain the file by hand, a dedicated llms.txt plugin can build it from your published posts and pages and regenerate it as content changes — the WordPress equivalent of generating the file dynamically. Browse the [llms.txt plugins in the WordPress directory](https://wordpress.org/plugins/search/llms.txt/), install one from Plugins → Add New, and configure which post types and pages it includes. Whichever route you pick, the file still has to serve as `text/plain` at `/llms.txt` and pass the spec.

## Common pitfalls when adding llms.txt to WordPress

- **Creating it as a Page or Post.** A Page titled "llms.txt" renders HTML at `/llms-txt/` with a `text/html` Content-Type — wrong path, wrong type. Use a real file.
- **Wrong directory.** The file must sit in the web root next to `wp-config.php`, not in `wp-content` or a theme folder.
- **Caching plugin or CDN interference.** Page caches and CDNs can serve a stale body or rewrite the Content-Type. Purge after every change and let `.txt` pass through as a static asset.
- **Nginx routing to index.php.** A `try_files` rule that skips `$uri` sends the request into WordPress and 404s it. Make sure the real file is matched first.
- **Expecting an SEO plugin to do it.** Yoast and Rank Math handle sitemaps and robots.txt, not llms.txt. Upload manually or use a dedicated plugin.

## Frequently asked questions

### Do I need a plugin to add llms.txt to WordPress?

No. The simplest approach is to upload a static llms.txt file to your site's root directory over SFTP or the host file manager — no plugin required. Reach for a plugin only if you want the file generated automatically from your published posts and pages and kept in sync as content changes.

### Where exactly do I put the llms.txt file in WordPress?

In the web root — the same folder that contains wp-config.php, wp-admin, and wp-content. That makes it resolve at https://yoursite.com/llms.txt, which is the canonical path AI clients try first. Don't place it inside wp-content, a theme directory, or a subfolder; for a WordPress install in a subdirectory, use that subdirectory's root.

### Can I create an llms.txt as a WordPress Page or Post?

No. A Page or Post titled 'llms.txt' renders as HTML at a slug like /llms-txt/, with a text/html Content-Type and the wrong path — three things that fail the spec at once. llms.txt must be a real plain-text file served at /llms.txt with a text/plain Content-Type, which a Page cannot produce.

### Will my caching or CDN plugin break llms.txt?

It can. Aggressive page caches and CDNs sometimes serve a stale body or rewrite the response to text/html. After you add or edit the file, purge the cache, and check that your CDN treats /llms.txt as a static text asset that passes through with a text/plain Content-Type rather than routing it through WordPress.

### Does Yoast or Rank Math generate llms.txt automatically?

No. SEO plugins like Yoast and Rank Math generate XML sitemaps and manage robots.txt, but they do not produce llms.txt — it's a different, newer convention. Either upload the file manually or install a dedicated llms.txt plugin that builds it from your content.

---

Read the full guide on the web: <https://agent-ready.dev/how-to-add-llms-txt-to-wordpress>

Validate your llms.txt: <https://agent-ready.dev/llms-txt-checker>

## Sitemap

See the full [sitemap](https://agent-ready.dev/sitemap.md) for all pages on agent-ready.dev.
