Web development

Understand what robots.txt controls

Robots.txt gives cooperating crawlers rules about requesting paths. It is not an access-control system and does not reliably remove a URL from search results by itself.

Worked example

Worked reference example

User-agent: *
Allow: /

Sitemap: https://example.com/sitemap.xml

How it works

This example permits crawling and advertises the sitemap location. Replace example.com with the actual site origin. The file belongs at the root /robots.txt, where crawlers look for it before fetching covered resources.

Limits and mistakes

Blocking a page can stop a crawler from seeing a noindex instruction on that page. Sensitive files require real authentication or removal from public hosting. Different crawlers may interpret or honor rules differently; do not assume all bots cooperate.

Check the result

Request /robots.txt directly and confirm it contains the intended plain text rather than an HTML fallback. Inspect crawling behavior through the relevant search-engine tools and hosting logs when available.

Sources

Reference documentation for the behavior used in this guide: