Technical SEO

How Google Finds Your Website: Robots.txt & XML Sitemap Made Simple

A beginner-friendly guide to the two small files that help search engines understand which pages to crawl and where to find your important content.

August 23, 2026 12 min read SEOZenith
Robots.txt and XML Sitemap Guide

Imagine opening a useful new shop, but nobody knows where it is. A website can face the same challenge: search engines must discover its pages, fetch them, and understand what each page is about before those pages can be considered for search results. Links between pages are one important way crawlers find their way around.

Two small files can help with that process: robots.txt communicates crawling preferences, while an XML sitemap lists important page URLs. They solve different problems. Neither file guarantees crawling, indexing, or a high position in Google, but both can make your website easier to understand and manage.

How Search Engines Find and Process Pages

Search engines use automated software called crawlers or bots. Google’s main web crawler is commonly called Googlebot. It follows links and fetches accessible pages; this visit is called crawling. Google then processes the page and may choose to add it to its index, a large database of pages eligible to appear in search.

Indexing is not automatic. Google considers many signals, including the page content, canonical URL, accessibility, and other information. Ranking comes later: it describes where a page appears for a particular search. A page can be crawled without being indexed, and being indexed does not promise a high position.

In short: Crawling → Indexing → Ranking. This is a simplified path, not a promise that every page will pass through every stage. Robots.txt mainly relates to crawling; a sitemap helps with URL discovery.

What Is Robots.txt?

A robots.txt file is a plain text file placed at the root of a website hostname. It gives instructions to crawlers that follow the Robots Exclusion Protocol about which URL paths they are asked to crawl or avoid. It is for managing crawler requests, not for hiding information from people.

1

Crawling, Indexing, and Ranking

The file is normally found at https://example.com/robots.txt, not inside a random folder. For SEOZenith, the expected location is https://seozeniith.netlify.app/robots.txt. Anyone can usually open this public text file, so never put passwords or confidential details in it.

2

Where Robots.txt Lives

For example, a site may want Googlebot to crawl its service pages but avoid spending time on internal search-result URLs. A small file could say: “User-agent: *” then “Disallow: /search/” and “Sitemap: https://example.com/sitemap.xml”. These lines express a preference to matching compliant crawlers.

3

User-agent: Who the Rule Is For

“User-agent: *” means the following rules are intended for all crawlers that follow this convention. A website can name a specific crawler, such as Googlebot, if a rule should apply only to that bot. A blank line can separate groups of rules.

4

Disallow and Allow: What Crawlers May Visit

“Disallow: /search/” asks matching crawlers not to crawl URLs whose paths begin with /search/. A “Disallow: /” rule asks them to avoid the whole site, so it can cause a serious problem when published accidentally. “Allow” can define an exception to a broader restriction; if there is no block, “Allow: /” is usually unnecessary.

How to Read a Robots.txt Example

A “Sitemap:” line gives the full location of a sitemap, for example “Sitemap: https://example.com/sitemap.xml”. This helps supporting crawlers locate the file. It does not force Google to crawl or index every URL listed there.

The Sitemap Line

An XML sitemap is a structured file containing URLs that you want search engines to know about. Think of it as a catalogue of important destinations. It can complement internal links, but it does not replace clear navigation: visitors and crawlers should still be able to reach important pages through the site.

A sitemap is particularly useful for a new website with few links from other sites, a large website with many pages, a site with pages that are not easy to reach through navigation, or a website that publishes new content often. Google may already find many URLs through links, but a sitemap can provide an additional discovery signal.

What an XML Sitemap Contains

A basic entry looks like this: <url><loc>https://example.com/services/</loc></url>. A complete sitemap wraps its entries in <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> and includes the XML declaration. The <loc> value should be the full, preferred canonical URL.

The optional <lastmod> element reports the date of a significant page update when that date is accurate, for example 2026-10-10. Do not change it every day to encourage crawling. Older tags such as <changefreq> and <priority> are not needed for a standard Google-focused sitemap.

What the XML Tags Mean

Robots.txt communicates crawling preferences; a sitemap suggests URLs for discovery. Robots.txt is plain text and may restrict a matching path for compliant bots. A sitemap is XML and does not control crawling. Neither file guarantees indexing or directly boosts rankings.

For example, a sitemap can list the home page, services, and useful blog articles, while robots.txt asks bots to avoid internal search URLs. Do not list URLs you intentionally block. The sitemap does not override robots.txt, and listing a URL does not make Google crawl it.

When to Include a Last Modified Date

Blocking crawling is different from preventing a page from appearing in search. A blocked URL may still be discovered through links, even if Google cannot read its content. If a public page should not appear in results, Google generally needs to crawl it to see a page-level noindex directive or an applicable X-Robots-Tag header.

Create a Basic Robots.txt File

For a small public site without special restrictions, a minimal robots.txt file can contain “User-agent: *” and “Sitemap: https://example.com/sitemap.xml”. Replace example.com with your real domain, and include the sitemap line only when that file exists. Do not copy another site’s rules without understanding them.

Publish and Check Robots.txt

Save the exact filename as robots.txt, then publish it at the root of the live hostname. On traditional hosting, use the file manager; on a custom site, include it in the public root or build output; on Netlify, make sure it is inside the directory that is actually deployed. Open the live URL to check the result.

What Is an XML Sitemap?

Many website platforms and SEO plugins create XML sitemaps automatically and update them when pages change. For a small site, you can also create a file manually and add each canonical URL inside a <url> and <loc> entry. For a larger or frequently updated site, automatic generation is easier to maintain.

Robots.txt XML Sitemap
Communicates crawling preferences Lists important URLs for discovery
Plain text XML
Usually /robots.txt Usually /sitemap.xml
Can request that compliant bots avoid matching paths Does not control crawling

Robots.txt vs XML Sitemap

Include canonical URLs of important pages you want search engines to discover: the home page, main services, useful location pages, product pages, and strong blog articles. Do not blindly list every URL. Review the file for 404 errors, redirects, duplicate versions, non-canonical URLs, internal search pages, tracking parameters, and pages marked noindex.

  • Your home page and main service pages
  • Useful, canonical blog articles
  • Important product or location pages
  • URLs that return a 404 error
  • Redirecting or duplicate URL versions
  • Pages marked noindex or set as non-canonical
  • Temporary tracking and internal search URLs

How the Two Files Work Together

To submit a sitemap, open Google Search Console and select the verified property for your website. Choose “Sitemaps” in the left menu, enter the sitemap path shown for your site, and submit it. Check the status; if Google cannot fetch it, verify the URL, public access, XML syntax, and listed page URLs. Submission still does not guarantee indexing.

WordPress may provide a sitemap at /wp-sitemap.xml, while an SEO plugin may use /sitemap_index.xml; the correct path depends on your setup. A custom-coded or Netlify site may need robots.txt and sitemap.xml added to its published directory. After deployment, open both live URLs and confirm they contain the expected files.

How to Create Robots.txt and a Sitemap

Robots.txt is not a security system. Malicious bots may ignore it, and the file itself is public. If information is confidential, protect it with authentication and server-side access controls. Do not rely on a robots.txt rule or a noindex tag to protect private information.

Create or Generate an XML Sitemap

When the files work together, robots.txt tells compliant crawlers which paths they are asked to avoid and where a sitemap can be found. The sitemap lists pages you consider important. Google can discover those URLs, decide which to crawl, evaluate whether to index them, and later determine their ranking.

Choose the Right URLs

Common robots.txt problems include blocking the entire site, blocking important service pages or blog posts, blocking CSS or JavaScript needed to render a page, using the wrong sitemap address, and treating the file as security. Read every rule carefully before publishing it.

Submit Your Sitemap in Search Console

Common sitemap problems include listing URLs that return 404, redirecting URLs, duplicates, non-canonical pages, noindex pages, malformed XML, and forgetting to update a manual file after publishing a new article. Keep the sitemap focused on current canonical URLs.

For WordPress and Custom-Coded Sites

Start by checking that both files open at their expected root URLs. Review robots.txt for accidental restrictions and confirm the sitemap contains important canonical pages without errors, redirects, or noindex URLs. In Search Console, check the sitemap report and use URL Inspection to investigate individual pages.

Protect Private Pages Properly

For a new website, confirm that the live files use the correct HTTPS domain rather than localhost, another domain, or a temporary preview URL. If a platform or plugin already maintains a sitemap, verify its location and avoid publishing a conflicting manual version.

Common Mistakes to Avoid

  • Blocking the entire website by accident
  • Blocking important pages or resources
  • Using robots.txt as a privacy or security tool
  • Pointing to a missing or incorrect sitemap
  • Leaving 404s, redirects, or duplicates in the sitemap
  • Forgetting to update a manually maintained sitemap
  • Assuming every submitted URL will be indexed

A Simple Technical SEO Checklist

You do not need to be an advanced developer to understand these files. Learn what each directive means, make careful changes, and verify the live result. A single incorrect “Disallow: /” rule can block crawling across the whole site for matching bots.

The goal is simple: help search engines discover the pages that matter, while avoiding accidental crawling restrictions. Clear internal links, useful content, correct canonical URLs, and thoughtful technical settings all work together.

Explore technical SEO with SEOZenith and make your important pages easier for search engines to discover.

Need Help With Technical SEO?

SEO, Local SEO, Content Marketing aur Website Optimization ke through apni online visibility improve karein.

Get Started