A robots.txt redirect is not automatically an error: RFC 9309 recommends following at least five consecutive redirects. If the file is reached within that sequence, its parseable rules apply in the context of the initial authority. Still, inspect every HTTP response to the final file. A redirect to another host does not make that host's file the robots.txt for every site it serves.
Google publishes its own behavior: its documentation describes at least five redirect hops and then treats the file as unavailable. That wording does not establish one universal maximum for every crawler. The reliable test is to request the actual starting URL, record each Location, and inspect the final rules.
What a robots.txt redirect changes
A direct robots.txt URL is tied to an origin: protocol, host, and port. Google's examples show that https://example.com/robots.txt does not automatically cover https://www.example.com, the HTTP version, or a non-standard port. The robots.txt glossary entry explains the rules in the file. A redirect adds a separate question: how does a crawler associate a file fetched from a different authority with the original request?
A 301 redirect is one possible hop in that sequence; what matters here is the final file and the authority to which its rules apply.
RFC 9309 answers that in section 2.3.1.2. Crawlers should follow at least five consecutive redirects, including redirects across authorities. If they reach robots.txt within that sequence, they must fetch it, parse its parseable rules, and follow those rules in the context of the initial authority. With more than five consecutive redirects, crawlers may assume that the file is unavailable. The wording matters: the standard recommends following at least five redirects, then requires the successful file to be used for the original authority when it is reached within five. It does not say that every crawler must stop after exactly the fifth hop.
Google documents its own behavior: Google follows at least five redirect hops and then stops, treating robots.txt as a 404. Its documentation says this also affects URLs that would have been disallowed in the chain, because the crawler could not fetch the rules due to the redirects. “At least five” means a minimum, not a published hard maximum of exactly five. The page also says Google does not follow logical redirects through frames, JavaScript, or meta refresh. A real HTTP 3xx response is different from a page that later changes location in a browser.
These rules concern robots.txt fetches. They do not prove that every crawler implements RFC 9309 in the same way, or that a redirect on an ordinary page has the same effect. For another bot, check its documentation and the requests visible in your server logs.
Example: the shop retrieves rules from another host
Suppose a store keeps a shared policy file on a CDN. Its response chain looks like this:
| Request | Response | Next request |
|---|---|---|
https://shop.example/robots.txt | 301, Location: https://edge.example.net/policies/shop-robots.txt | https://edge.example.net/policies/shop-robots.txt |
https://edge.example.net/policies/shop-robots.txt | 200 with robots.txt text | End |
Under RFC 9309, the rules reached in this example are applied to the original origin, https://shop.example, the request using the https scheme and shop.example host. The target URL on edge.example.net does not become the rules file for every site hosted by that CDN. If https://www.shop.example/robots.txt points to the same file, test that starting URL separately. Each redirect sequence begins with its own authority.
A path change on the same host still matters. Under HTTP semantics, a relative Location such as /robots/current.txt is resolved against the response target URI using URI-reference resolution. A redirect to http:// instead of https://, to another host, or to a different port is also part of the observed behavior. Do not assume that two URLs with similar names return the same policy.
How to inspect the complete chain
Start with the authorities that serve content: for example, HTTPS and HTTP, the apex domain and www, relevant subdomains, and any non-standard ports. Add old and new hosts during a migration. One host redirecting to another file does not remove the need to test the remaining hosts.
Use a GET request. A HEAD test can trigger different server rules and does not prove that a crawler receives the same body. With curl, you can save every response header and the final target:
bashcurl -sS -L --max-redirs 10 -D - -o /dev/null \
-w 'final=%{url_effective} status=%{http_code} redirects=%{num_redirects}\n' \
https://shop.example/robots.txt
The 10 is curl's own ceiling, not a simulation of a particular crawler. Compare the complete chain with the robots.txt behavior documented by the crawler you are investigating.
On Windows, call curl.exe explicitly. Windows PowerShell 5.1 maps curl to Invoke-WebRequest, which accepts different arguments; PowerShell 7+ does not define that alias. This one-line PowerShell form writes the response body to NUL and keeps the redirect headers visible:
powershellcurl.exe -sS -L --max-redirs 10 -D - -o NUL -w 'final=%{url_effective} status=%{http_code} redirects=%{num_redirects}\n' https://shop.example/robots.txt
The -D - output is useful during diagnosis because it shows the headers for each response. Record the request URL, status code, Location value, and resolved next target for every hop. HTTP's Location field can contain an absolute URL or a relative reference. A relative reference is resolved using the requested URL and the reference path.
Then inspect the final response, not just the status at the starting URL:
- Does the sequence continue through an HTTP redirect, or does JavaScript or a meta refresh load another page later?
- How many consecutive redirects separate the starting URL from the file?
- Does the chain end with a successful response and actual robots.txt content? Do the encoding, content, and expected path make sense?
- Is there a loop, a missing
Location, a login, an error page, or an unexpected language switch? - Does each relevant starting authority receive the policy intended for that host?
A single test does not tell you which cached version Google is currently using. It shows what the URL returned at that moment. Keep timestamps and repeat the check after changing CDN, server, or redirect configuration. Server logs can show whether a verified crawler requested the starting URL and final destination. They do not prove that every page URL was later crawled or indexed.
Failure modes that are easy to miss
The starting URL redirects to the home page. The browser visit may look successful, but the destination often returns HTML instead of the requested rules. The robots.txt specification requires a UTF-8 file with the text/plain media type. Serve the rules from a clear HTTP endpoint, not a visual page with site navigation.
The redirect ends on the wrong host. A policy file may be shared by several properties. That can work if its rules are appropriate for each initial authority. It becomes risky when the shared text contains paths meant for only one property. Check the effect of the returned rules for every starting URL, not just the CDN path.
A browser succeeds but a crawler receives something else. A browser can use cookies, a login, JavaScript, or a service worker. None of those substitutes for a crawler's robots.txt request. Compare an anonymous GET with server logs and the edge configuration. If redirects depend on request headers, document those conditions and test the responses for the relevant user agents.
The monitor follows redirects but records only the final status. A check that stores only “200” hides the intermediate responses. It cannot show whether one redirect is intentional or the chain is growing. Keep the number and destination of every hop in the audit record.
A crawling issue is mistaken for an indexing issue. robots.txt controls crawler access. It is not a reliable way to remove a URL from search. Google's introduction to robots.txt explains this distinction. A page reported as “crawled, currently not indexed” needs a different diagnosis from an unreachable rules file; the guide to crawled but currently not indexed URLs covers that status. Keep crawling and indexing separate so that a redirect chain is not treated as a complete explanation for an indexing state.
What should the robots.txt response look like?
For day-to-day operation, a direct successful response from each relevant starting URL is easiest to inspect. A short redirect to a managed location can still be useful, such as when a policy is centrally maintained. It adds dependencies: the target must stay reachable, the content must be right for the original host, and a later rule change must not silently switch the returned file.
A short HTTP chain is therefore a maintenance choice, not a ranking promise. It reduces the number of places where path, host, or status can change unexpectedly. For a large site, the crawl budget is broader context, not a direct measure of robots.txt redirect risk. Prioritize the check by affected origins, duration, and failure frequency. One redirect alone does not justify a broad migration. A loop or a chain that never reaches the intended file does need a specific fix.
For a broader technical review, the Site Audit overview provides product context for crawlability, indexing, and redirect findings. The article on AI crawlers and robots.txt covers an adjacent but different question: which crawler rules the file contains. This guide is about the file an HTTP request actually reaches and the original host to which its rules apply.
Approve a redirect only after a repeatable check: request every relevant starting URL, save each hop, inspect the final file, and map the change back to the authority it is meant to govern. Keep different domains on separate lines in the audit record. That turns “robots.txt loads” into a checkable finding without turning one successful HTTP response into a claim about indexing or rankings.