Skip to main content

Fix Sitemap URL Not Allowed in Search Console: 11 Cases Tested

Sitemap URL not allowed means a <loc> sits outside the sitemap's host, protocol, port or folder. I ran 11 setups through a checker: 6 fail, 1 needs robots.txt.

• • 9 min read
Dashboard cover for a post on fixing the Search Console sitemap error URL not allowed: compare every loc against the sitemap's scheme, host, port and folder, find the mismatch, and move or rewrite the sitemap

TL;DR — Sitemap URL not allowed is the Search Console error for a <loc> that sits outside the sitemap’s scope: a different protocol, host or port than the sitemap URL, or a folder above or beside the one holding the file. I ran 11 real-world setups through a checker that applies the sitemap protocol’s rules, and 6 failed, mostly on http vs https and www vs apex. The fix is to put one sitemap at the root of the canonical host and make every <loc> start with exactly that origin.

This error is less mysterious than most Search Console messages. It’s pure string comparison. The hard part is noticing which of four parts of the URL drifted, because the URLs usually look right at a glance.

What Does URL Not Allowed Mean in a Sitemap?

It means Google found a URL in your sitemap that the sitemap isn’t allowed to vouch for. Google’s Sitemaps report help describes it as a sitemap that “includes some URLs that are at a higher level or different domain than the sitemap file,” and tells you to “check that the URLs all begin with the same domain as your sitemap location.”

The rule comes from the sitemaps.org protocol. A sitemap’s location limits which URLs it can list. A file at http://example.com/catalog/sitemap.xml can list URLs under http://example.com/catalog/, but not under /images/. Every URL must use the same protocol and host as the sitemap, and if the sitemap URL carries a port, every URL must carry the same port. URLs that break the rule are dropped from that sitemap.

So “scope” has four parts. A <loc> is allowed only when all four match:

Part of the URLMust match the sitemap’sExample that fails
Protocolhttps: vs http:http://www.example.com/a in an https sitemap
HostExact hostname, www includedhttps://example.com/a in a www sitemap
PortExplicit port, if anySitemap at :8443, URLs with no port
PathAt or below the sitemap’s folder/products/a in /blog/sitemap.xml

There’s one documented exception, and one wrinkle. The exception: a sitemap may list URLs for other hosts if those hosts prove they trust it, which I cover in the last section. The wrinkle: Google’s build-a-sitemap guide says that “unless you submit your sitemap through Search Console, a sitemap affects only descendants of the parent directory.” That reads as if Search Console lifts the folder rule. The Sitemaps report help still lists higher and sibling folders as URL not allowed. Google doesn’t reconcile the two, so I treat the path rule as live and keep the sitemap at the root, where it can’t break.

Which Sitemap Setups Trigger URL Not Allowed?

I wrote a checker that parses a sitemap URL and each <loc>, then compares protocol, host, port and folder in that order, plus an optional Search Console property. Then I ran it over 11 setups I’ve seen in real reports and forum threads. These are fixture URLs on example.com, so the result shows what the protocol’s rules say, not a live Google verdict.

SetupChecker resultVerdict
Root sitemap, <loc> on the same originokPass
http:// URLs in an https sitemapprotocol-mismatchFail
Apex URLs in a www sitemaphost-mismatchFail
Staging host leaked into <loc>host-mismatchFail
/blog/sitemap.xml listing /products/ pagessibling-dirFail
/blog/sitemap.xml listing the homepageabove-sitemap-dirFail
Sitemap URL on :8443, URLs with no portport-mismatchFail
Sitemap on cdn.example.com listing www URLshost-mismatchFail, unless cross-submitted
Uppercase host in <loc> (WWW.Example.com)okPass
Subdomain sitemap in a Domain propertyokPass
Subdomain sitemap in a www URL-prefix propertyoutside-propertyWrong property, not wrong file

Six setups fail outright. The CDN case fails until the main host’s robots.txt points at the CDN file. The last row isn’t a sitemap error at all. Google’s help notes that “the report shows only sitemaps that are in the current property,” so a blog. subdomain sitemap simply doesn’t belong in a www URL-prefix property. Add a Domain property, or a URL-prefix property for the subdomain, and submit it there.

The uppercase row passes because hostnames are case-insensitive, and new URL() lowercases them before comparison. Paths are case-sensitive, so /Blog/ in a /blog/sitemap.xml would fail.

Eleven sitemap setups checked against the sitemap protocol's scope rules. Two same-origin setups and a subdomain sitemap in a Domain property pass. Protocol, host, port, staging-host, sibling-folder and parent-folder mismatches fail. A CDN-hosted sitemap passes only with a robots.txt cross-submission, and a subdomain sitemap in a www URL-prefix property is in the wrong property

A Script That Checks Every Sitemap URL Against Its Scope

This is the checker behind the table. It needs Node 18+ and no dependencies. Point it at a sitemap or a sitemap index, and optionally pass the Search Console property you submitted it in. It walks child sitemaps, tallies every <loc> by reason, and prints one example per failure type.

JavaScript
// check-sitemap-scope.mjs — node check-sitemap-scope.mjs <sitemap-url> [property]
// property: "sc-domain:example.com" or a URL-prefix like "https://www.example.com/"
export function classify(loc, sitemapUrl, property) {
  let l; try { l = new URL(loc); } catch { return 'not-absolute'; }
  const s = new URL(sitemapUrl), dir = s.pathname.replace(/[^/]*$/, '');
  if (l.protocol !== s.protocol) return 'protocol-mismatch';
  if (l.hostname !== s.hostname) return 'host-mismatch';
  if (l.port !== s.port) return 'port-mismatch';
  if (!l.pathname.startsWith(dir))
    return dir.startsWith(l.pathname.replace(/[^/]*$/, '')) ? 'above-sitemap-dir' : 'sibling-dir';
  if (property?.startsWith('sc-domain:')) {
    const d = property.slice(10);
    if (l.hostname !== d && !l.hostname.endsWith('.' + d)) return 'outside-property';
  } else if (property && !l.href.startsWith(property)) return 'outside-property';
  return 'ok';
}

const locsOf = (xml) => [...xml.matchAll(/<loc>s*([^<]+?)s*</loc>/g)].map((m) => m[1].replace(/&amp;/g, '&'));
const [url, property] = process.argv.slice(2);

async function visit(sm, depth = 0) {
  const pad = '  '.repeat(depth);
  const res = await fetch(sm, { signal: AbortSignal.timeout(15000) });
  if (res.url !== sm) console.log(`${pad}! ${sm} redirects to ${res.url}: submit that URL instead`);
  const xml = await res.text(), locs = locsOf(xml), isIndex = /<sitemapindex/.test(xml), tally = {};
  for (const loc of locs) (tally[classify(loc, sm, property)] ??= []).push(loc);
  const bad = Object.entries(tally).filter(([k]) => k !== 'ok');
  console.log(`${pad}${bad.length ? '✗' : '✓'} ${sm}  ${locs.length} ${isIndex ? 'sitemaps' : 'URLs'}, ${tally.ok?.length || 0} in scope`);
  for (const [k, v] of bad) console.log(`${pad}    ${k}: ${v.length}  e.g. ${v[0]}`);
  let failures = bad.length;
  if (isIndex) for (const child of tally.ok || []) failures += await visit(child, depth + 1);
  return failures;
}
process.exitCode = (await visit(url)) ? 1 : 0;

Run against this site’s own sitemap index, in the Domain property, it’s clean:

Text
✓ https://umesh-malik.com/sitemap-index.xml  2 sitemaps, 2 in scope
  ✓ https://umesh-malik.com/sitemap.xml  510 URLs, 510 in scope
  ✓ https://umesh-malik.com/blog-sitemap.xml  213 URLs, 213 in scope

Then I ran it on the same file requested through the www host. On December 5, 2026, https://www.umesh-malik.com/sitemap-index.xml answered 200 with the identical bytes instead of redirecting. Every child sitemap it lists is on the apex host:

Text
✗ https://www.umesh-malik.com/sitemap-index.xml  2 sitemaps, 0 in scope
    host-mismatch: 2  e.g. https://umesh-malik.com/sitemap.xml

That’s the most common real-world shape of this error. Nobody wrote a wrong URL. The sitemap is fine on its canonical host, and someone submitted it under the other one, often because the www URL-prefix property was the one they verified first.

How to Fix Sitemap URL Not Allowed in 6 Steps

  1. Copy the exact sitemap URL from the Sitemaps report, and note which property you’re in. A URL-prefix property for https://www. and one for https:// are different properties with different scopes.

  2. Run the checker with that URL and property. The failure type tells you which part drifted. Fix the biggest bucket first, because one setting usually explains all of it.

  3. For protocol-mismatch or host-mismatch, fix the URL generator, not the sitemap file. In WordPress this is the WordPress Address and Site Address settings, or a hardcoded WP_HOME. In a framework it’s the site URL config, such as site in Astro or metadataBase in Next.js. Staging hosts leak in when the build reads a preview environment variable.

  4. For sibling-dir or above-sitemap-dir, move the sitemap to the root. If you need one file per section, keep them at the root as /sitemap-blog.xml and /sitemap-products.xml and list both in a root sitemap index. A sitemap index has the same scope rule as the sitemaps it lists.

  5. For port-mismatch, submit the sitemap without the port. A port in the sitemap URL usually means it was copied from an origin server or a dev proxy. Public URLs on 443 don’t include it.

  6. Delete the old entry, submit the corrected URL, and check the count. In the Sitemaps report, remove the failing sitemap and submit the root one in the property for the canonical host. The status should change to Success with a discovered-URL count close to your <loc> count.

Before step 6, check that every <loc> is also the page’s canonical. A sitemap full of in-scope URLs that redirect or point their canonical elsewhere moves the problem to Page with redirect or Google chose different canonical.

A five-gate check that every sitemap loc must pass in order: protocol, host, port, folder, and finally the Search Console property. Each gate names the failure it catches and the fix: https everywhere, one canonical host, no port, sitemap at the root, and submitting in a Domain property or the matching URL-prefix property

When Can a Sitemap List URLs on Another Host?

When the other host says so. The sitemaps.org protocol calls this cross-submission. To let cdn.example.com/sitemap-www.xml list www.example.com URLs, add this line to https://www.example.com/robots.txt:

Text
Sitemap: https://cdn.example.com/sitemap-www.xml

The protocol’s reasoning is that the owner of a host’s robots.txt is implicitly vouching for the external file. Each target host references its own sitemap, and that sitemap lists only that host’s URLs. Google’s guide adds the Search Console route: verify every site, and you can submit one sitemap containing URLs for all of them.

This site does exactly that, in reverse. Its robots.txt on both hosts lists the three apex sitemaps, so crawlers that read robots.txt are told where the canonical files are. That works because the files are on the host they describe.

SituationIs it allowed?What makes it work
Sitemap on the same host and protocol, at the rootYesNothing extra
Sitemap on a CDN or storage bucket hostOnly with proofSitemap: line in the target host’s robots.txt, or both hosts verified
One sitemap for several of your domainsOnly with proofEvery domain verified in Search Console
Sitemap on www, pages on apexNoMove it, or regenerate it for the canonical host
Subdomain sitemap in the parent’s URL-prefix propertyWrong propertySubmit in a Domain property instead

What Breaks If You Ignore It?

The out-of-scope URLs are dropped from that sitemap, so those pages lose their sitemap discovery path. Pages with plenty of internal links will still be found. New or deep pages that only the sitemap points at are the ones that wait, and they tend to land in Discovered – currently not indexed.

It’s also a clue about something bigger. A sitemap that mixes http and https, or www and apex, almost always means the site’s canonical host isn’t settled. That shows up later as duplicate without user-selected canonical. Fix the host once and both errors go away.

If the sitemap now passes the checker but Search Console reports something else, the neighbouring errors are covered in this series: Couldn’t fetch, Sitemap appears to be an HTML page, and Sitemap contains URLs blocked by robots.txt. The rest is in the AI search hub.

FAQ

What does URL not allowed mean in a sitemap?

It means the sitemap lists a URL outside its own scope. In practice the URL uses a different protocol, host or port, or sits in a folder above or beside the one holding the sitemap.

Does www vs non-www cause URL not allowed?

Yes. www.example.com and example.com are different hosts to the sitemap protocol, so every URL is out of scope. Make the sitemap’s host match the canonical host your pages use.

Can I keep my sitemap in a subfolder like /blog/sitemap.xml?

Yes, if every URL in it is inside /blog/. For a sitemap that covers the whole site, the root is the only location that can’t trip the folder rule.

Can a sitemap hosted on a CDN list URLs for my main site?

Only with proof you own both hosts. Add a Sitemap: line pointing at the CDN file in the main host’s robots.txt, or verify both hosts in Search Console.

Does Google index the URLs that trigger URL not allowed?

They’re dropped from that sitemap, but links can still lead Google to them. The cost is slower discovery for pages that rely on the sitemap.

Sources

  • Google Search Console Help, Manage your sitemaps using the Sitemaps report: the URL not allowed definition (higher level, sibling directory, different domain) and the note that the report shows only sitemaps in the current property.
  • sitemaps.org, Sitemaps XML format: the sitemap file location rule, the same-protocol, same-host and port rules, and cross-submission through robots.txt.
  • Google Search Central, Build and submit a sitemap: the root-location recommendation, the parent-directory scope sentence, and cross-site sitemaps for verified sites.
  • First-party test: the checker in this post run over 11 fixture setups, plus umesh-malik.com’s sitemap index fetched through the apex and www hosts, December 5, 2026.

Frequently asked questions

Share this article:
X LinkedIn

Google Search · Preferred sources

Prefer this site on Google

If you already read this writing, add umesh-malik.com as a Preferred Source. Google can then highlight it with a preferred badge in Top Stories, AI Overviews, and AI Mode — for you, not as a site-wide ranking boost.

Keep reading

Get new posts on AI, Claude Code & LLMs

New deep-dives on AI engineering, Claude Code, and developer tooling — follow along however you prefer.