Webmaster Bench

Tools / Guides / "Sitemap contains URLs which are blocked by robots.txt": find them and fix them

"Sitemap contains URLs which are blocked by robots.txt": find them and fix them

The warning means your sitemap asks Google to crawl URLs that your robots.txt tells it not to crawl. One of the two files is wrong for each URL; here is how to find the URLs and decide which.

Published 2026-11-20. Last updated 2026-11-20. Written by Webmaster Bench; see About for how the guides are made and checked.

Try it: robots.txt Tester: Test whether Googlebot, Bingbot or AI crawlers may fetch a URL, and see which rule decides.

What the warning says

Google's Sitemaps report help describes it like this: Google "cannot access your sitemap, or can't access all the content listed in your sitemap, because it is blocked by a robots.txt file." Its advice is to use the URL Inspection tool to confirm which file is blocked and change robots.txt to allow it.

That advice assumes the URL should be crawled. Often it should not, and then the sitemap is what needs changing. A sitemap is a list of the pages you want in search; Google's sitemap documentation says to include the URLs "you want to see in Google's search results" and, where the same content has several URLs, only the one you prefer. A URL you block on purpose does not belong there. So for each blocked URL the question is: should Google crawl this page?

  • Yes: the robots.txt rule is too broad. Narrow it.
  • No: the sitemap is too broad. Remove the URL from it, usually by changing what the sitemap plugin or script includes.

If the sitemap file itself is blocked, the report says Couldn't fetch instead; that case has its own guide.

Step 1: get the list of URLs in the sitemap

Search Console's message may show only examples. To test them all, take the URLs from the sitemap itself. On macOS or Linux:

curl -s https://www.example.com/sitemap.xml | grep -o '<loc>[^<]*' | sed -e 's/<loc>//' -e 's/&amp;/\&/g'

The last part turns &amp; back into &: inside the XML, an ampersand in a URL is written as &amp;, but the real URL has a single &. For a sitemap index, run the command on each child sitemap it lists. The sitemap validator also shows the first 50 entries of a pasted sitemap.

Step 2: test them against the live robots.txt

Open https://www.example.com/robots.txt, copy it into the robots.txt tester, choose Googlebot, and paste the URL list into the URL box. Use the file the server returns now, not the one in your repository or your plugin's settings screen: a CMS or SEO plugin can serve a different robots.txt from the one you think you have.

Worked example

This site blocks its internal search, its tag pages and every URL with a query string:

User-agent: *
Disallow: /search
Disallow: /tag/
Disallow: /*?

Its sitemap lists five URLs. The tester's verdicts for Googlebot, computed from this exact file:

CrawlerResultURL pathDecided by
GooglebotAllowedhttps://www.example.com/products/leather-boots/no rule in the * group matches
GooglebotBlockedhttps://www.example.com/search-engine-basics/line 2: Disallow: /search
GooglebotBlockedhttps://www.example.com/tag/boots/line 3: Disallow: /tag/
GooglebotBlockedhttps://www.example.com/products/leather-boots/?color=brownline 4: Disallow: /*?
GooglebotBlockedhttps://www.example.com/search?q=bootsline 2: Disallow: /search

On a narrow screen, swipe the table sideways for the other columns.

Four of the five are blocked, for three different reasons:

  1. /search-engine-basics/ is an article. It is blocked by accident: robots.txt rules match the start of the path, so Disallow: /search also blocks every URL that begins with /search. Fix the rule.
  2. /tag/boots/ is blocked on purpose. Fix the sitemap: stop including tag pages.
  3. /products/leather-boots/?color=brown is a filtered copy of a product page, blocked on purpose by /*?. The canonical URL (the first row) is already listed. Fix the sitemap: list only canonical URLs.
  4. /search?q=boots is an internal search result. Fix the sitemap.

The corrected robots.txt blocks the search folder and the search query URLs without catching the article:

User-agent: *
Disallow: /search/
Disallow: /search?
Disallow: /tag/
Disallow: /*?
CrawlerResultURL pathDecided by
GooglebotAllowedhttps://www.example.com/products/leather-boots/no rule in the * group matches
GooglebotAllowedhttps://www.example.com/search-engine-basics/no rule in the * group matches
GooglebotBlockedhttps://www.example.com/tag/boots/line 4: Disallow: /tag/
GooglebotBlockedhttps://www.example.com/products/leather-boots/?color=brownline 5: Disallow: /*?
GooglebotBlockedhttps://www.example.com/search?q=bootsline 3: Disallow: /search?

On a narrow screen, swipe the table sideways for the other columns.

One difference from the original: a bare /search, with no slash and no query string, is no longer blocked. If the site serves a page at that exact address and wants it blocked too, add Disallow: /search$ (the $ means the path ends there, so /search-engine-basics/ stays allowed).

The three URLs still blocked are the ones the site does not want crawled, and they come out of the sitemap. Then the sitemap and robots.txt agree, and the warning has nothing left to report.

Advertisement

Causes the tester cannot see

  • Another host's robots.txt. Google's robots.txt rules apply only to the protocol, host and port where the file is served. If the sitemap lists http:// URLs, or URLs without www, the rules that count are in that host's robots.txt, which may be an old or staging file with Disallow: /. The tester checks paths only, so test the robots.txt of the host each URL actually uses, and fix the sitemap to list the canonical host.
  • A staging file that went live. A Disallow: / written to keep a test site out of search, copied to production at launch, blocks everything. Every sitemap URL is then reported.
  • Google's cached copy. Google generally caches robots.txt for up to 24 hours. The warning can outlast your fix by that long. The robots.txt report in Search Console shows which version Google has and lets you ask for a recrawl.

Do not use robots.txt to keep a page out of search

A common reason for the conflict is a page that someone wanted out of Google, blocked in robots.txt, and left in the sitemap. robots.txt does not do that job. Google's documentation says a disallowed URL can still be indexed if other pages link to it, and then appears in results without a description. To keep a page out of results, use a noindex rule, and leave the page crawlable: Google's noindex documentation says the page "must not be blocked by a robots.txt file", or the crawler never sees the rule. So for a page you want out of search, remove it from the sitemap, allow crawling, and add noindex.

Checklist

  1. Extract every URL from the sitemap (and from each child sitemap).
  2. Test them as Googlebot against the live robots.txt of the same host.
  3. For each blocked URL: should Google crawl it? Yes: narrow the rule. No: remove it from the sitemap.
  4. Re-test the whole list, deploy, and confirm one URL with URL Inspection's live test.
  5. Resubmit the sitemap in Search Console.

Sources

Advertisement