robots.txt Sitemap

The Sitemap directive tells crawlers where your XML sitemap lives. It's the easiest win in a robots.txt file — and one of the most common to get slightly wrong with a relative URL.

RSRobots.txt Studio Editorial Updated June 8, 2026 Reviewed against Google Search Central and RFC 9309

The Sitemap directive

Sitemap is a file-level directive: it isn't tied to any User-agent group and can appear anywhere in the file. It must be a full, absolute URL.

Correct: absolute URL
Sitemap: https://example.com/sitemap.xml

Relative URLs are invalid

Sitemap: /sitemap.xml is ignored. The directive requires the full https://... URL, including the protocol and host.

Multiple sitemaps

You can list as many sitemaps as you like — one per line. Large sites often split sitemaps by section or content type.

robots.txt
Sitemap: https://example.com/sitemap-pages.xml
Sitemap: https://example.com/sitemap-products.xml
Sitemap: https://example.com/sitemap-blog.xml

Sitemap index files

If you have many sitemaps, reference a single sitemap index instead — it links to the individual sitemaps, keeping robots.txt clean.

robots.txt
Sitemap: https://example.com/sitemap_index.xml

Where to put it

Anywhere works, but most teams put Sitemap lines at the very top or very bottom of the file for readability. Order has no effect on behavior.

robots.txt
User-agent: *
Allow: /
Disallow: /admin/

Sitemap: https://example.com/sitemap.xml

The Generator adds and positions the Sitemap line for you, and the Validator warns if it's missing or uses http instead of https.

Common sitemap mistakes

  • Relative path

    Use the absolute URL, not /sitemap.xml.

  • http on an https site

    Match your canonical protocol — declare the https:// sitemap URL.

  • Sitemap as the only submission method

    robots.txt discovery is passive; also submit your sitemap in Google Search Console for reporting.

  • Pointing to a 404

    Make sure the sitemap URL actually resolves before referencing it.

Frequently asked questions
Can I list multiple sitemaps in robots.txt?

Yes. Add one Sitemap line per sitemap. For many sitemaps, reference a single sitemap index file that links to the rest.

Does the Sitemap line need to be a full URL?

Yes. It must be an absolute URL including protocol and host (https://example.com/sitemap.xml). Relative paths are ignored.

Where should the Sitemap line go in robots.txt?

Anywhere — it's file-level and not part of any group. Top or bottom of the file is conventional for readability.

Is robots.txt the only way to submit a sitemap?

No. The Sitemap directive helps crawlers discover it passively, but you should also submit your sitemap directly in Google Search Console and Bing Webmaster Tools.

Robots.txt Generator

Build a valid robots.txt from presets and crawler toggles — no syntax required.

Open the Generator
Related resources
Next upWhy robots.txt Is Important
RS

Robots.txt Studio Editorial · Technical SEO & crawling

We build robots.txt tooling and parse thousands of real-world files. Guides are written by practitioners and reviewed against the Google and RFC 9309 specifications.