Skip to content

What Is robots.txt and How Does It Affect Data Collection?

robots.txt is a small text file that tells automated clients which parts of a site they are asked to avoid. Here is how to read it and how it shapes lawful data collection.

9 min readUpdated Nov 14, 2026By XPASS Editorial Team

What Is robots.txt and How Does It Affect Data Collection?

If you collect data from websites with scripts, crawlers or scheduled jobs, the first file you should look at is not the page you want. It is robots.txt. This small text file sits at the root of most sites and tells automated clients which areas the owner would like them to stay out of. Reading it takes a minute, and ignoring it is one of the fastest ways to turn a harmless data project into a dispute with a site owner.

This article explains what robots.txt is, how its rules are written and read, what it does and does not cover, and how to build it into a routine that respects the sites you work with. It is written for people who collect publicly available information for research, price comparison or monitoring, and who want to do it in a lawful and considerate way. For the wider picture, pair it with the responsible web data collection checklist.

What robots.txt is

The Robots Exclusion Protocol is a convention that began in the mid-1990s and was later written down as a formal standard in RFC 9309. The idea is simple. A site owner places a plain text file at a fixed address, such as https://example.com/robots.txt. Before a well-behaved crawler requests any other page on that host, it downloads this file and reads the rules that apply to it.

The file is not part of a page and it is not a login system. It is a published statement of preferences. Search engines use it to decide which URLs to crawl. Archiving tools, monitoring tools and in-house data collectors can use it for the same reason: it is the clearest, machine-readable signal a site owner has for saying "please do not automate requests here".

Three details matter in practice:

  • The file must live at the root of the host. A file at /blog/robots.txt is not read as the rules for the site.
  • Each host and protocol has its own file. Rules on www.example.com do not automatically apply to shop.example.com.
  • The file is plain text, encoded as UTF-8, and served over HTTP like any other resource. A missing file usually means there are no stated restrictions, while a server error can mean something different, as we discuss below.

How the rules are written

A robots.txt file is made of groups. Each group starts with one or more User-agent lines naming the clients it applies to, followed by Disallow and Allow lines that list URL paths. Here is a small, plain example:

User-agent: *
Disallow: /cart/
Disallow: /search
Allow: /search/help

User-agent: ExampleBot
Disallow: /

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

Read it from the top. The first group applies to every client that has no more specific group. It asks clients not to request anything under /cart/ or paths starting with /search, except /search/help. The second group applies to a client that identifies itself as ExampleBot and asks it to stay away from the whole site. The last line is not a rule at all; it simply points to the sitemap.

The main directives

Directive Meaning Notes
User-agent Names the client the group applies to * means any client not matched by a more specific group
Disallow A path prefix the client is asked not to request An empty value means nothing is disallowed
Allow A path prefix that is explicitly permitted Used to carve an exception out of a wider Disallow
Sitemap Location of a sitemap file Not a crawl rule; helps discovery
Crawl-delay A requested pause between requests Not part of RFC 9309; some clients honour it, others ignore it

Matching rules in short

Paths are matched from the start of the URL path, and the most specific matching rule wins. If an Allow and a Disallow rule are equally specific, the standard says the less restrictive one, the Allow, is used. Two special characters are widely supported: * matches any run of characters, and $ marks the end of the URL. Matching is case-sensitive for the path, so /Admin/ and /admin/ are different.

Your own client should name itself honestly in its User-agent header and match against that name, not borrow the name of another crawler to get a more permissive group. A custom client with a clear name and a contact address gives site owners a way to reach you if something goes wrong.

What robots.txt does not do

It is tempting to treat the file as a complete rulebook. It is not, and understanding the gap protects you.

It is not access control

Anyone can request a disallowed URL directly. The file only describes what the owner prefers. If something is genuinely private, it must sit behind authentication. For that reason you should never treat an allowed path as proof that you are entitled to everything on it, and you should never treat a disallowed path as a puzzle to solve.

The terms of use of a site, copyright law, database rights, contract terms and privacy and data protection law are all separate. A page can be allowed by robots.txt and still contain material you may not copy, republish or process in the way you intended. Personal data is a particular risk: collecting names, contact details or profile information from public pages can still fall under data protection rules in the place where you or the data subjects are located. If you are unsure, take advice from a qualified professional before you build a pipeline around it.

It does not control search indexing perfectly

A disallowed URL can still appear in search results if other sites link to it, because the search engine never fetched the page to see its content. Controlling indexing is done with other tools, such as noindex directives, and that is a different subject from controlling automated data collection.

It does not cover every kind of automation

Some owners publish additional signals: terms pages that forbid automated access, API documentation that tells you to use an official endpoint, or HTTP response headers and status codes that tell you to slow down. All of these are part of the picture. A robust collector reads robots.txt first and then keeps paying attention to what the server says on each response.

How errors and missing files are handled

RFC 9309 gives guidance on what a client should do when it cannot read the file cleanly. In general terms:

What the client receives How it is usually treated
A normal response with content Parse the rules and follow them
404 or another "not found" style response Treat as no restrictions published, but still be considerate
A server error or an unreachable host Treat the site as temporarily off limits and try again later rather than assuming everything is allowed
A redirect Follow a small number of redirects, then use the final file
A very large file A client may stop reading after a size limit, which the standard says should be at least 500 KiB

The key lesson is the third row. If the file cannot be retrieved because the server is failing, the cautious reading is to wait, not to proceed as if there were no rules. This is a good habit in general: when in doubt about permission, pause and check, rather than carrying on.

Building robots.txt into a collection workflow

The goal is a routine where checking the rules is automatic and cannot be forgotten. Here is a practical sequence.

Step 1: Fetch and cache the file per host

Before the first request to a host, download its robots.txt using your real User-agent string. Cache the result. A day is a common refresh interval for many projects, and RFC 9309 recommends not holding a cached copy for longer than 24 hours unless the file cannot be reached. Store the time you fetched it, so you can show later which version of the rules you followed.

Step 2: Check every URL against the rules

Do not eyeball the file once and then hard-code a list. Use a well-tested parser library for your language and ask it, for each URL you plan to request, whether your user-agent may fetch it. This also handles wildcards and the longest-match logic correctly. If the answer is no, drop the URL from the queue and log the reason.

Step 3: Respect the pace the site can handle

Even where a path is allowed, a site has limited capacity. Keep your request rate low and steady, add small random pauses, and back off at once if you see responses such as 429 Too Many Requests or 503 Service Unavailable. RFC 9110 describes these status codes and the Retry-After header, which tells you how long to wait. If the file includes a Crawl-delay, treat it as a useful hint about the owner's wishes even though it is not part of the formal standard.

Step 4: Prefer an official source when one exists

If a site offers an API, a data feed, a downloadable dataset or a partner programme, use that. It is usually more stable, better documented and clearly permitted. Scraping HTML should be the fallback, not the first choice.

Step 5: Keep a record

Log which robots.txt version you used, which URLs you skipped and why, and when the last successful fetch took place. A simple record turns a vague claim of good behaviour into something you can show a colleague, a client or the site owner.

A plain example

Imagine a small online shop that wants to compare the public list prices of ten products across a handful of retailer websites once a day. The team sets up a script and decides to follow a clear routine.

For each retailer host, the script fetches /robots.txt at the start of the run and stores it. It then reads the rules for its own named client. Retailer A disallows /cart/ and /account/ but allows product pages, so the script queues only product URLs. Retailer B disallows everything under /products/ for generic clients and publishes a link to a partner data feed in its terms page. The team skips the product pages on that site and applies to use the feed instead. Retailer C returns a server error for robots.txt on Tuesday. The script records the failure, skips Retailer C for that run, and tries again the next day.

The script sends one request every few seconds per host, stops for the day if it receives repeated 429 responses, and writes a short log. Nobody on the team has to remember to check the rules, because the code does it. Costs and data volume stay modest, and the team can explain exactly what it did. If you are budgeting a project like this, the article on proxy budgeting for price monitoring shows how to plan request volume realistically.

Where proxies fit in, and where they do not

A proxy is an intermediary that forwards your requests, so the target site sees the proxy's IP address instead of yours. MDN has a clear overview of how proxies and tunnels work. Teams use them for legitimate reasons: viewing a public page as a visitor in another region would, spreading a modest, polite workload across addresses, or keeping research traffic separate from office traffic.

What a proxy does not do is change the rules. The robots.txt file and the site's terms apply to your automated client no matter which IP address it uses. Rotating addresses in order to slip past a disallow rule, a block or a rate limit that the owner has put in place is exactly the behaviour that turns a data project into a dispute, and it is not something this guide recommends. Use a proxy to reach public pages from the right place, at a sensible pace, and within the site's stated rules and local law. The responsible data collection checklist covers more of those boundaries, and the market intelligence guide shows how the collected data is turned into decisions.

Limits and what to watch for

  • Rules change. Owners update robots.txt when sites are redesigned or when they notice heavy automated traffic. Refresh the file on a schedule and stop if a path you used becomes disallowed.
  • Different user-agents get different rules. A group written for another crawler does not apply to you. Match on your own honest name, and check the wildcard group as the fallback.
  • Blocks may exist beyond the file. A site can use technical measures that have nothing to do with robots.txt. If you meet repeated blocks or challenge pages, treat them as a signal to stop and reconsider, not as an obstacle to defeat.
  • Allowed does not mean any volume is fine. Keep your load proportionate to the value of the data. Collecting less, less often, is usually enough.
  • Personal data needs extra care. Public does not mean there are no rules. Avoid gathering personal information you do not need, and apply data minimisation.
  • Terms and local law still apply. Check the site's terms of use and the law in your location before you rely on any data commercially.

Summary

robots.txt is a short, standardised text file that tells automated clients which parts of a site the owner asks them not to request. It is a courtesy and a clear signal, not a security measure and not the full set of rules. A responsible collector fetches it per host, caches it, checks every URL against it with a proper parser, paces requests, prefers official data sources, and keeps a log. A proxy changes the network path only; it never changes what the site owner has asked of you.

If your project needs a proxy to view public pages from a particular region at a considerate pace, you can look at the options on the XPASS proxy page and check which plan details apply to your use.

Frequently asked questions

What is robots.txt?

It is a plain text file placed at the root of a website, for example at /robots.txt. It lists which paths automated clients are asked not to request, and it is standardised in RFC 9309.

Is robots.txt a security feature?

No. It is a request, not an access control. A path listed in it is not protected, and it can even point curious people to areas the owner would rather not advertise. Real protection needs authentication and server-side permissions.

Does robots.txt replace a site's terms of use?

No. It covers crawler behaviour only. The terms of use, copyright, privacy law and contracts are separate sources of rules, and a responsible data collector checks all of them.

Should I fetch robots.txt before every request?

You should fetch it before crawling a host, cache it for a sensible period, and refresh it regularly. Re-reading it on every single request would add needless load, but never reading it is the bigger mistake.

Does using a proxy change what robots.txt asks of me?

No. A proxy only changes the network path your request takes. The site owner's rules apply to your automated client whatever IP address it uses, so you should follow them the same way.

About the author

Bob Kanokphon Thongdee, founder of XPASS VPN

Bob Kanokphon Thongdee

  • Founder of XPASS VPN
  • Co-founder of eSIMonline.asia
  • More than 7 years in online marketing
  • Founder of Cojourney Visa and Cojourney Travel

Need a proxy for this?

XPASS Proxy sells residential proxy traffic by the gigabyte, with the price shown before you pay.

See proxy plans

Keep reading

Proxy Guides

Responsible Web Data Collection: What to Check Before You Start

A step-by-step checklist for collecting public web data responsibly, from defining your purpose and reading site terms to limiting load, protecting personal data and knowing when to stop.

10 min read

Proxy Guides

How to Plan a Proxy Budget for Price Monitoring

A price monitoring budget starts with your workload, not with a price list. This guide shows how to estimate requests, traffic and regions, then match them to a proxy plan.

9 min read

Proxy Guides

What Is Market Intelligence for Online Brands?

A plain introduction to market intelligence for online brands: what to track, where public data comes from, how to turn it into decisions and how to do it responsibly.

9 min read