Fix a Relative Sitemap URL in robots.txt

A robots.txt file uses paths in Allow and Disallow rules, but Google expects the Sitemap directive to include the scheme and host. If it says Sitemap: /sitemap.xml, use the full public URL of the sitemap or sitemap index.

Worked example

A full URL in the Sitemap directive

User-agent: *
Disallow:

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

Steps

  1. Find the actual public address of your sitemap or sitemap index. Use that address in the robots.txt generator's sitemap field or edit the directive directly.
  2. Replace the example hostname with your own and save the file at /robots.txt for the origin you want to configure. Check the live file for the full Sitemap URL and its exact capitalization.
  3. Open the declared URL and confirm it returns the intended sitemap XML, then inspect any child sitemaps from the index. An HTML error page or login page indicates the endpoint is not ready for crawlers.

What to check

  • The example announces a sitemap index. Use the actual filename your site serves; the name sitemap-index.xml is only an example.
  • A valid declaration makes the sitemap discoverable. It does not prove that a crawler fetched it, processed every URL, or indexed the pages.

Generate robots.txt with a full sitemap URL

References