A navigation link can use /services/ as a relative path. An XML sitemap requires a complete page URL, including the protocol and host, such as https://example.com/services/.

Where does the base URL come from?

Inspect the step that turns a content path into a full address. A CMS or router may return only the path. The generator then needs an explicitly configured public base URL.

Fictional example: the CMS stores /insights/checkout/, and the export copies that value unchanged. The fix belongs in the export’s URL construction, rather than in a manual rewrite of every CMS record.

Before changing it, check whether the site runs under a subdirectory. Combining https://example.com/shop/ with a path starting in a slash can produce an address outside /shop/. Check the resulting destination rather than assuming the strings will join as intended.

Start with a small sample

Compare the homepage, a deeply nested page and a path containing a special character. Each should lead to the correct public site. Check that an already complete URL does not receive a second base URL.

Use a URL library with a fixed base and clear input rules. Blindly copying the incoming request host can put preview addresses or unwanted hosts into the exported sitemap.

Related check: Remove redirects from a sitemap.

For an identified URL-generation change in an existing frontend, consider Frontend optimisation; technical suitability is checked first.

Sources