Freelancer Tamal
All articles
Technical SEO· 7 min · November 10, 2026

robots.txt and XML Sitemaps for Beginners

What each file does, a safe starter version of both, and the mistakes that accidentally hide sites from Google.

Rahatul Ashiq Tamal, SEO expert
Written & reviewed by

SEO, AEO and GEO consultant · Technical SEO, local SEO and content strategy

Last reviewed November 10, 2026

Rahatul Ashiq Tamal, SEO expert in Rangpur, Bangladesh
Written by Author profile

SEO, AEO & GEO consultant based in Rangpur, Bangladesh. Technical SEO, local search and content strategy. Full bio →

Quick answer

robots.txt tells crawlers which parts of your site they may crawl; an XML sitemap lists the URLs you want discovered. robots.txt does not reliably keep a page out of search results — use `noindex` for that — and a sitemap does not guarantee indexing.

A safe starter robots.txt

For most small sites a minimal file is best: allow everything and point to your sitemap.

`User-agent: *` · `Allow: /` · `Sitemap: https://example.com/sitemap.xml`

What a sitemap should contain

  • Only canonical, indexable URLs that return 200.
  • Accurate `lastmod` dates — only change them when content really changes.
  • No redirected, noindex or error pages.
  • Most CMSs and SEO plugins generate one automatically (WordPress setup).

Submit and monitor

  1. Add the sitemap in Search Console under Sitemaps.
  2. Also submit it in Bing Webmaster Tools.
  3. Check the Pages report for excluded URLs.

Mistakes that hide sites

  • `Disallow: /` left over from a staging site.
  • Blocking CSS or JavaScript Google needs to render pages.
  • Blocking a page in robots.txt while adding noindex to it — Google can't see the noindex if it can't crawl.

What about AI crawlers?

Some AI crawlers respect robots.txt rules by user-agent. Decide deliberately; see llms.txt explained for the related file.

Sources and limits

This is a practical guide based on public documentation and day-to-day SEO work. It reports no original dataset, guarantees no ranking, and gives no fixed timeline.

Google: Introduction to robots.txt

Google: Sitemaps overview

Frequently asked

Do small sites need a sitemap?

Google says small, well-linked sites may not need one, but it is easy to add and helps with monitoring.

Where does robots.txt go?

At the root of the domain, for example example.com/robots.txt.

How do I remove a page from Google?

Use a noindex tag and let Google crawl it, or remove the page and return 404/410.

Free auditBook a call