/ โ† Learning Hub / Robots & Sitemap Fixes
On this page
  1. Two files, two different jobs
  2. The fix guides
  3. Which findings to fix first
  4. How robots.txt rules are actually read
  5. Keeping the sitemap honest
  6. Order of work
  7. Questions and answers

Two files, two different jobs

Much of the confusion around these files comes from expecting them to do things they do not do. It is worth being precise.

robots.txtXML sitemap
What it doesTells compliant crawlers which URL paths they may not fetch.Lists URLs you want search engines to discover, with optional last-modified dates.
What it does not doIt does not remove pages from the index, and it does not hide anything from people or badly behaved bots.It does not force indexing, and listing a page does not make it rank.
Where it livesAlways at the root of the host: https://www.example.co.uk/robots.txt. Each host and protocol has its own.Anywhere on the host, declared in robots.txt and submitted in Search Console.
When it goes wrongPages you want in search stop being crawled.Search engines waste time on dead URLs and lose trust in the dates you give.

The key point is that robots.txt controls crawling, not indexing. If you want a page kept out of search results, it needs a noindex meta tag or header that crawlers are allowed to fetch and read. Blocking it in robots.txt can have the opposite effect, which is the subject of one of the guides below.

๐Ÿ’ก robots.txt is public. Anyone can read it, so listing private admin paths in it can advertise them. Protect private areas with a login, not a Disallow line.

The fix guides

The finding guides are grouped by which file the problem lives in, followed by platform guides.

Problems in robots.txt

Fixing accidental robots.txt blocks covers the full-site Disallow: / left over from staging and broad patterns that catch public pages by mistake, with a pre-launch check to prevent it. Fixing robots.txt syntax errors covers misplaced wildcards, malformed User-agent lines and directives search engines silently ignore. Fixing a missing or wrong sitemap declaration covers the Sitemap: line, which must be a full absolute URL pointing at the XML file or sitemap index.

Problems in the sitemap

Fixing dead URLs in the sitemap covers removing errors, redirects and noindexed pages so the sitemap lists only live, indexable URLs. Fixing oversized sitemap files covers the limit of 50,000 URLs or 50 MB uncompressed per file and splitting into a sitemap index by section, type or date. Fixing lastmod and priority misuse covers keeping lastmod honest and why priority values are not worth fussing over.

Problems between the two

Fixing crawler-trap patterns covers endless filter combinations, calendars that go back for decades and other URL spaces that never end. Fixing conflicting noindex and Disallow covers the common mistake of blocking a page and noindexing it at the same time, so the noindex is never seen.

By platform

The WordPress guide covers sitemaps generated by core or by Yoast and Rank Math, virtual and physical robots.txt files and multisite. The Shopify guide covers the automatic sitemap index and the limited ways robots.txt can be customised. The Next.js guide covers generating both files from app/robots.ts and app/sitemap.ts and handling very large sites at build time.

Which findings to fix first

  1. Anything that blocks the whole site or a major section. A single Disallow: / under User-agent: * stops compliant crawlers fetching anything. Fix this within the hour, not the week.
  2. A robots.txt that returns a server error. Google has documented that if robots.txt returns a 5xx error it may treat the site as fully blocked for a time. A missing robots.txt that returns a 404 is treated as no restrictions, which is far less harmful.
  3. Noindex and Disallow on the same URL. The page you meant to remove may stay in results.
  4. Syntax errors. A broken rule is usually ignored, so it may be allowing or blocking something you did not intend.
  5. Dead or redirected URLs in the sitemap. They waste requests and make the sitemap look unreliable.
  6. Missing or relative sitemap declaration. Easy to fix, and it helps every search engine find the sitemap, not only those you submit to by hand.
  7. Crawler traps. Serious on large or filtered sites; less urgent on small brochure sites.
  8. Oversized files and lastmod issues. Tidy these once the rest is clean.
โš ๏ธ Before editing robots.txt on a live site, save a copy of the current file. A one-character change can have sitewide effects, and being able to restore the previous version quickly is the simplest safety net.

How robots.txt rules are actually read

Many syntax findings come from assumptions about how rules combine. Google documents the following behaviour, and other major search engines work in a similar way:

User-agent: *
Disallow: /basket/
Disallow: /*?sort=
Allow: /basket/help

Sitemap: https://www.example.co.uk/sitemap.xml

In this example every crawler is kept out of basket pages except the help page, sorted listing URLs are blocked, and the sitemap is declared with its full address. Search Console's robots.txt report shows the version Google last fetched and any lines it could not parse.

Keeping the sitemap honest

A sitemap works best when search engines can trust it. If half its URLs redirect, return errors or carry a noindex, it becomes a list of suggestions they learn to check rather than rely on. The tester checks each listed URL for exactly this reason.

A trustworthy sitemap follows a few rules:

For how the sitemap compares with the pages a crawler actually finds through links, see the Site Crawler Guide.

Order of work

  1. Run the Robots & Sitemap Tester and save the current robots.txt as a backup.
  2. Remove any rule that blocks pages you want in search, and make sure robots.txt itself returns a 200 or a 404, never a server error.
  3. Correct syntax errors and simplify the file; fewer, clearer rules are easier to reason about.
  4. For pages you want removed from results, lift any Disallow and use noindex instead until they drop out.
  5. Add an absolute Sitemap: line for your sitemap or sitemap index.
  6. Regenerate the sitemap so it lists only live, indexable, canonical URLs with honest dates, split into an index if needed.
  7. Block genuine crawler traps with targeted patterns, checking that no real content is caught.
  8. Submit the sitemap in Search Console, check its robots.txt report, and run the tester again.

The example report shows the tester's output on a real configuration, and the Robots & Sitemap Guide is the full reference. For wider on-page checks, see the Site Audit Guide.

Questions and answers

1. Does blocking a page in robots.txt remove it from Google?

No. robots.txt stops compliant crawlers from fetching the page, but Google can still index the URL if other pages link to it, usually showing it with no description. To remove a page from results, allow it to be crawled and add a noindex meta tag or X-Robots-Tag header, then wait for search engines to recrawl it. Once it has dropped out you can decide whether to block crawling as well, though usually there is no need.

2. Do I need a robots.txt file at all?

No. If a site has no robots.txt and the URL returns a 404, search engines treat that as permission to crawl everything, which is fine for many small sites. A robots.txt becomes useful when you want to keep crawlers out of areas such as basket pages, internal search results or filter combinations, or to declare your sitemap location. What you must avoid is a robots.txt URL that returns a server error, because that can be treated as a block.

3. Where should my sitemap be and what should it be called?

It can be at any URL on the same host, and the name does not matter to search engines, though sitemap.xml or sitemap_index.xml at the root are common and easy to find. What matters is that it is valid XML, returns a 200 status, and is declared with a full absolute URL on a Sitemap line in robots.txt. Submitting it in Google Search Console and Bing Webmaster Tools as well gives you reports on how it is being processed.

4. Does Google use the priority and changefreq values in my sitemap?

Google has said it ignores both priority and changefreq. It does use lastmod, but only when the dates are consistently accurate, meaning they change when the page content genuinely changes. Other search engines may treat these fields differently, so there is no harm in including them if your system generates sensible values. Just do not spend time tuning them, and never set every lastmod to today's date on each rebuild, as that teaches search engines to ignore it.

5. How many URLs can one sitemap contain?

A single sitemap file can list up to 50,000 URLs and must be no larger than 50 MB uncompressed. Larger sites split their URLs across several sitemap files and list those files in a sitemap index, which can itself reference up to 50,000 sitemaps. Splitting by content type, such as products, categories and articles, also makes it easier to see in Search Console which section has pages that are not being indexed.

6. Why is Google indexing a page I blocked in robots.txt?

Because the block prevents crawling, not indexing. If other pages or other websites link to the blocked URL, Google may still list it, usually with a note that no information is available. Google cannot see any noindex tag on the page because it is not allowed to fetch it. Remove the Disallow for that URL, add noindex, and let it be recrawled. Search Console reports this situation as indexed though blocked by robots.txt.

7. Should I block AI crawlers in robots.txt?

That is a business decision rather than a technical fix, and it is separate from search engine indexing. Several AI companies publish crawler names that respect robots.txt, and some separate crawlers used for training from those used to fetch pages when answering a question. Blocking the latter can remove you from AI answers. If you do add rules, name each crawler explicitly in its own group, and check that the rules do not also catch Googlebot or Bingbot.

Check your crawl rules now

The Robots & Sitemap Tester fetches your robots.txt and every declared sitemap, validates both, checks each listed URL responds with a 200, flags inconsistent lastmod dates and tests for crawler-trap risk.

Run the Robots & Sitemap Tester โ†’
๐Ÿ’ฌ Got a problem?
Related Guides: Robots & Sitemap Guide  ·  Example Report  ·  Site Crawler Guide  ·  Site Audit Guide  ·  Learning Hub

About aiwebpageseo

aiwebpageseo.com is a data-driven SEO and AEO (Answer Engine Optimisation) platform providing a free suite of technical SEO tools. Rather than relying on AI-theorised assumptions, the platform analyses live URL performance, delivering objective diagnostics, page speed metrics, CLS debugging, and site crawl data alongside actionable technical tutorials.