Why Sitemap URLs Must Be Absolute

Short answer

The sitemap protocol requires each loc value to be a complete URL including the protocol and host, so https://example.com/page rather than /page. A relative path is a genuine validation error, not a style preference.

Run the Sitemap Validator

Check one sitemap against the protocol, by URL or pasted XML.

Why relative paths cannot work

A sitemap is a standalone document that crawlers fetch on its own. Nothing in it tells a parser what host to resolve a relative path against, and while a crawler could guess from where it fetched the file, the protocol does not ask it to.

So a loc of /about is not a URL, it is a fragment, and a strict parser rejects it. Some crawlers may resolve it charitably; relying on that is relying on undefined behaviour.

The fix is mechanical: emit the full URL. If your generator is producing relative paths, it is almost certainly missing a base URL configuration value.

Get the host exactly right

Absolute is necessary but not sufficient, because the host has to be the one you actually canonicalise on.

Mixing www and non-www is the common error. If your site canonicalises to https://example.com but the sitemap lists https://www.example.com, every entry points at a URL that redirects. A sitemap full of redirects is a weak signal.

Protocol matters the same way. Listing http URLs on an https site means every entry redirects.

So the rule is stricter than absolute: list the exact canonical URL, the one that returns 200 without redirecting.

Cross-domain rules

A related constraint people run into when consolidating sitemaps.

A sitemap is expected to cover URLs on the same host as the sitemap itself. A sitemap at example.com/sitemap.xml listing URLs on othersite.com is not something you should expect to work.

This also means each subdomain needs its own sitemap. A blog at blog.example.com is a separate host and needs its own file, declared in its own robots.txt.

Search Console has historically supported cross-submission when you verify both properties, but it is a special case rather than the default, and the simple path is one sitemap per host.

Common questions

Can sitemap URLs be relative?+

No. The protocol requires complete URLs including the protocol and host. A relative path is a validation error, and while some crawlers may resolve it charitably, that is undefined behaviour.

Does www versus non-www matter in a sitemap?+

Yes. List the exact canonical form, the one that returns 200 without redirecting. A sitemap where every URL redirects to the other variant is a weak signal.

Can one sitemap cover several domains?+

Not by default. A sitemap is expected to cover URLs on its own host, and each subdomain needs its own file declared in its own robots.txt.

My generator emits relative paths. How do I fix it?+

It is almost always a missing base URL setting. Find where your generator or framework configures the site URL and set it to your canonical origin.

Sources

A sitemap helps machines find your pages

It does nothing for the visitor who lands on one and cannot find what they came for. A Venbit agent reads your pages and answers them directly, by text or by voice. Free to start, no card.