Go straight to the answers
Vega SEO Talks

How should robots.txt directives be structured for a multi-tenant SaaS platform where each tenant has unique crawl requirements on shared URL patterns?

Answered 3-minute answer rooted in 1 page

Give each tenant its own hostname if you can, because robots.txt is scoped per host and the problem then disappears. Google’s robots.txt specification states that “The rules listed in the robots.txt file apply only to the host, protocol, and port number where the robots.txt file is hosted.” On subdomains, tenant-a.example.com and tenant-b.example.com each serve their own file, and no rule in one can affect the other. If tenants share one host and are separated by path, there is exactly one file for all of them, and every tenant’s rules must be written into it with Google’s precedence in mind: “When matching robots.txt rules to URLs, crawlers use the most specific rule based on the length of the rule path.” Order in the file does not decide which rule wins.

Two architectures

Subdomain per tenant Path per tenant
robots.txt files One per tenant host One shared file
Rule conflicts between tenants Impossible Must be resolved by path length
Adding a tenant Generate its file at provisioning Regenerate and retest the shared file
Testing Robots.txt report per host Every tenant path against one file

Source: Google’s robots.txt specification.

How precedence works in a shared file

Take two rules in one file:

  • Disallow: /tenant-a/ (10 characters)
  • Allow: /tenant-a/public/ (17 characters)

A request for /tenant-a/public/report matches both. The Allow rule is longer, so it wins, wherever it sits in the file. When two matching rules are equally specific, the specification adds that Google uses the least restrictive rule, so an allow beats a disallow of the same length.

Rules for generating the shared file

  1. Write platform-wide rules broadly: admin, staging and internal API paths for all tenants.
  2. Write tenant overrides with longer paths than any broad rule they need to beat.
  3. Generate the file from tenant settings with the same precedence logic, not by concatenating each tenant’s rules.
  4. Test real URLs for every tenant against the generated file before deploying, and confirm Google’s fetched copy in the robots.txt report.
  5. Refuse configurations that cannot be satisfied: two tenants wanting opposite treatment of an identical path pattern cannot both get it in one file.

What robots.txt cannot do here

  • No crawl rate per tenant. Google’s specification lists the fields it supports and says others, such as crawl-delay, are not supported. Crawl capacity is set per host from server health.
  • No indexing control. robots.txt controls crawling. A tenant that wants pages kept out of the index needs noindex on pages Google can crawl, not a disallow.
  • No privacy. Disallowed paths are still public URLs; private tenant data needs authentication.

A worked example

For example, imagine a platform at example.com with 2,000 tenants under /t/name/. One tenant wants its /t/acme/reports/ section blocked while its /t/acme/reports/public/ subsection stays crawlable; another wants everything open. The generator writes Disallow: /t/acme/reports/ and Allow: /t/acme/reports/public/, leaves the second tenant with no rules, and a test run against sample URLs for all 2,000 tenants confirms each outcome before release. For new enterprise customers, the platform moves to subdomains, where each tenant gets its own file.

For multi-tenant platforms, subdomains give each tenant an independent robots.txt by design, while a shared host forces every tenant’s rules into one file resolved by path length, which must be generated with Google’s precedence logic and tested against real tenant URLs.

Answers that share these roots

  1. How does Google treatment of subdomains versus subfolders differ in terms of authority inheritance, crawl budget allocation, and topical association? shares 1 page
  2. What are the crawl and indexing consequences when a robots.txt file returns a 5xx error versus a 404 versus a timeout? shares 1 page
  3. How does Googlebot robots.txt caching mechanism work, and what happens to crawl behavior during the window between a robots.txt update and Googlebot re-fetch? shares 1 page
  4. How should a site handle 503 status codes during scheduled maintenance to preserve crawl equity while signaling temporary unavailability to Googlebot? shares 1 page

Replies to this answer

Leave a Reply

Your email address will not be published. Required fields are marked *