# Use absolute URLs

- Check 39.05 · llms.txt and AI formats (experimental) · Experimental
- Source: https://checklist-seo-geo.com/en/llmstxt-ai-formats-experimental/use-absolute-urls
- Write every llms.txt link as an absolute HTTPS URL on the canonical domain, detect relative or staging links and fix the generators.
- Updated on 2026-11-25
- Licence: CC BY 4.0. Credit “Checklist SEO & GEO” with a link to https://checklist-seo-geo.com/en/llmstxt-ai-formats-experimental/use-absolute-urls.
- Plugin checklist-seo-geo: 1.3.1 · https://github.com/maximegaul/checklist-seo-geo

## In short

Every link in an `llms.txt` file must be a complete URL: `https://` protocol, canonical domain and path, such as `https://example.com/tarifs/`. No `/tarifs/`, no `tarifs.html`, no `http://`, no staging address. Once this check is done, every link in the file works even when copied out of context, and points straight to the canonical version of the page. The `llms.txt` format remains experimental.

## Why it matters

An agent does not always read `llms.txt` from its original address. The content may be copied into a conversation, loaded into a model's context, cached by a tool or aggregated into a directory of files. Once detached from its URL, a relative link such as `/docs/api.md` no longer says which domain the page is on: the agent has to guess, and may get it wrong or give up.

The llmstxt.org proposal does not spell this out as a requirement, but all its examples use absolute URLs, and the files published by OpenAI, Anthropic or documentation platforms do the same. It is the convention to follow.

Absolute URLs have their own pitfall: they hard-code a domain. A file generated on a staging server, behind a misconfigured proxy or before the switch to HTTPS contains links to `http://`, `staging.example.com` or `localhost:3000`. At best they redirect; otherwise they lead to an inaccessible page or to an environment you did not want to expose.

## What it improves

- **Links usable anywhere**: in the file, copied into a prompt or aggregated by a tool.
- **Fewer requests**: a link to the canonical version avoids an `http` to `https` or `www` to non-`www` redirect.
- **Security**: no staging or internal address leaks into a public file.
- **Citations and ranking**: no demonstrated effect. No practice guarantees a citation or a recommendation.

## How to check

**1. Find the links that do not start with `https://`:**

```bash
curl -s https://example.com/llms.txt | grep -n -E '\]\(' | grep -v -E '\]\(https://'
```

No output: every link is absolute and uses HTTPS. Every line displayed needs fixing.

**2. List the domains present:**

```bash
curl -s https://example.com/llms.txt \
  | grep -o -E '\]\(https?://[^/)]+' | sed 's/^](//' | sort | uniq -c | sort -rn
```

Compliant result: your canonical domain (`https://example.com`), plus any official external domains you chose to link (GitHub repository, status page). Any mention of `localhost`, an IP address, `staging.`, `preprod.`, `dev.` or the non-canonical variant of your domain (`www.` or without `www.`) is an error.

**3. Check that no link redirects:**

```bash
curl -s https://example.com/llms.txt \
  | grep -o -E '\]\(https://[^)]+\)' | sed -E 's/^\]\(//; s/\)$//' \
  | while read -r url; do
      printf "%s %s\n" "$(curl -s -o /dev/null -w '%{http_code}' "$url")" "$url"
    done | grep -v "^200"
```

No output: every link returns `200` with no redirect.

## How to implement

### Before you start

Four rules apply to every environment:

| Rule | Correct | Incorrect |
|---|---|---|
| HTTPS protocol | `https://example.com/tarifs/` | `http://example.com/tarifs/` |
| Canonical domain | `https://example.com/tarifs/` if the site is without `www` | `https://www.example.com/tarifs/`, which redirects |
| Full path, including the trailing slash if your URLs have one | `https://example.com/tarifs/` | `https://example.com/tarifs`, which redirects |
| No internal address | `https://example.com/docs/` | `https://staging.example.com/docs/`, `http://localhost:3000/docs/` |

Your canonical domain and protocol are those defined in [standardize HTTP/HTTPS and www/non-www](https://checklist-seo-geo.com/en/indexing-canonicalization/standardize-http-https-www-non-www). If a Markdown version of a page exists, its URL follows the same rules (`https://example.com/docs/api.md`).

The HTTP `Link` header that points to the file (`Link: </docs/llms.txt>; rel="describedby"`) can, however, stay relative: it is resolved against the URL of the response that carries it, and the proposal's example writes it that way.

For a hand-written file, replace `](/` with `](https://example.com/` in a text editor, then run check 1 again.

### WordPress

Versions: WordPress 6.6 and later.

SEO plugins build the links from the site address. In `Settings > General`, check the `WordPress Address (URL)` and `Site Address (URL)` fields: they must start with `https://` and use your canonical domain. If these fields are grayed out, they are defined in `wp-config.php`:

```php
define('WP_HOME', 'https://example.com');
define('WP_SITEURL', 'https://example.com');
```

After a migration from staging, URLs from the old domain sometimes remain in the database (content, menus, Rank Math's “Additional Content” field). Find them with WP-CLI before replacing:

```bash
wp search-replace 'https://staging.example.com' 'https://example.com' --all-tables --dry-run
```

Remove `--dry-run` once you have checked the result, after backing up the database. Then regenerate the file (turn the plugin's `llms.txt` feature off and on again if it does not update by itself) and run the checks again.

### Laravel

Versions: Laravel 12 and 13.

The `route()` and `url()` helpers produce absolute URLs. Their domain depends on the context:

- during an HTTP request, they use the request's host and protocol;
- in an Artisan command or a scheduled task that generates a static file, they use `APP_URL`.

So set `APP_URL=https://example.com` in the production `.env`. Behind a load balancer or a CDN that terminates HTTPS, declare the trusted proxies in `bootstrap/app.php`, otherwise Laravel produces `http://` links:

```php
use Illuminate\Foundation\Configuration\Middleware;

->withMiddleware(function (Middleware $middleware): void {
    $middleware->trustProxies(at: '*');
})
```

Restrict `at` to your proxies' addresses if you know them. In a Blade view that generates `llms.txt`, write `{!! route('pricing') !!}` rather than a hard-coded path.

### Next.js

Versions: Next.js 15 and 16 (App Router).

Centralize the domain in an environment variable defined per environment (`.env.production`):

```txt
SITE_URL=https://example.com
```

Then, in `app/llms.txt/route.ts`, build every link with `new URL()`:

```ts
const siteUrl = process.env.SITE_URL ?? 'https://example.com';

const absolute = (path: string): string => new URL(path, siteUrl).toString();

export async function GET() {
  const body = [
    '# Planifia',
    '',
    '> Online software for scheduling technical field work.',
    '',
    '## Product',
    '',
    `- [Pricing](${absolute('/tarifs')}): plans and prices excluding tax`,
  ].join('\n');

  return new Response(body, {
    headers: { 'Content-Type': 'text/plain; charset=utf-8' },
  });
}
```

Do not build the domain from the request's `Host` header: on Vercel, preview deployments would produce links to their own temporary domain.

### Nginx

Versions: Nginx 1.24 and later.

If the file is generated by an application behind Nginx acting as a reverse proxy, pass on the original host and protocol, otherwise the application sees `http://127.0.0.1:3000`:

```nginx
location / {
    proxy_pass http://127.0.0.1:3000;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
```

Reload: `sudo nginx -t && sudo systemctl reload nginx`. The application, for its part, must trust these headers (see the Laravel section).

### Shopify

Versions: Shopify admin, all plans, November 2026.

Write the links with your primary domain (`Settings > Domains`), never with the store's `*.myshopify.com` address, which redirects to the primary domain. If you add links by hand in a generation app, check this point after every domain change.

### Documentation platforms

Docusaurus builds URLs from the `url` and `baseUrl` fields of `docusaurus.config.js`: `url: 'https://example.com'` and `baseUrl: '/docs/'` if the documentation is served under `/docs/`. On Mintlify or GitBook, set up the custom domain before reviewing the generated file, so that it does not point to the platform's subdomain.

## Common mistakes

- **Relative links** (`/tarifs/`, `./api.md`): unusable as soon as the content is read away from its URL.
- **A file generated on staging** then copied to production with its `staging.` links.
- **`http://` instead of `https://`**: every link costs a redirect, and a tool that does not follow redirects fails.
- **Non-canonical variant of the domain** (`www.` when the site is without `www`): a redirect every time.
- **The platform's domain** (`*.myshopify.com`, a documentation tool's subdomain) instead of the primary domain.
- **Domain derived from the `Host` header** in a generator: preview deployments produce temporary links.
- **Fixing the file without fixing the generator**: the error returns at the next regeneration.

## Frequently asked questions

### Are relative URLs forbidden in llms.txt?

The llms.txt proposal does not explicitly forbid them, but all its examples use absolute URLs, as do the files published by OpenAI or Anthropic. A relative URL only works if the agent knows the file's original address, which is no longer the case when its content is copied into a prompt or aggregated by a tool. So always write the full protocol and domain.

### Should llms.txt links include www?

In llms.txt, use the same form of the domain as your canonical URLs. If your site is served on example.com and redirects www.example.com, write https://example.com in every link, and vice versa. A link to the non-canonical variant works thanks to the redirect, but adds a request and contradicts the canonical tags and the sitemap, which should all point to the same address.

### Why does my llms.txt contain http links when the site uses https?

An llms.txt file generated by an application behind a proxy, a load balancer or a CDN often receives the request over plain HTTP. If the application does not trust the X-Forwarded-Proto headers passed on by the proxy, it builds http links. Declare the trusted proxies in the application, set the site address to HTTPS in its configuration, then regenerate the file.

### Can llms.txt link to external sites with absolute URLs?

Yes, and that is in fact the only way to do it. An llms.txt file can link to official external resources, such as your GitHub repository, your status page or a standard you implement, by writing their full HTTPS URL. Stick to resources you control or that are authoritative, and check periodically that they still respond with a 200 code.

## Resources

- [llmstxt.org: the llms.txt proposal](https://llmstxt.org/)
- [Google Search Central: specify a canonical URL](https://developers.google.com/search/docs/crawling-indexing/consolidate-duplicate-urls?hl=en)
- [Laravel: configuring trusted proxies](https://laravel.com/docs/13.x/requests#configuring-trusted-proxies)
- [WordPress: changing the site URL](https://developer.wordpress.org/advanced-administration/upgrade/migrating/) and [WP-CLI: search-replace](https://developer.wordpress.org/cli/commands/search-replace/)
- [Docusaurus: url and baseUrl configuration](https://docusaurus.io/docs/api/docusaurus-config#url)
- [MDN: Link header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Link)

Next steps: [keep the file up to date](https://checklist-seo-geo.com/en/llmstxt-ai-formats-experimental/keep-file-up-date) and [exclude confidential data](https://checklist-seo-geo.com/en/llmstxt-ai-formats-experimental/exclude-confidential-data).
