robots.txt unreachable, 404, 403 or 500: what Google does and how to fix it
Before Googlebot crawls any page on a host, it fetches that host's robots.txt file, and the status code it gets back decides how the whole site is crawled. A missing file is harmless: Google treats a 404 as permission to crawl everything. A server error is different. If robots.txt answers with a 5xx error, a 429 or a timeout, Google treats the site as blocked until it can read the file, and crawling can grind to a halt even though every page works for visitors. This guide explains what each response means to Google, how to check the file on every host you run, the firewall and CMS problems that most often break it, and how to serve a simple static file that keeps working when the rest of the site is struggling.
Why the robots.txt response matters so much
robots.txt is a plain text file at the root of a host, such as https://www.example.com/robots.txt. Crawlers that follow the Robots Exclusion Protocol, Googlebot included, request it before crawling and keep a copy for a while. Google generally caches it for up to 24 hours, and longer if it cannot fetch a fresh copy.
The rules inside the file only matter if Google can read them. When it cannot, Google has to decide what to do with no instructions, and it bases that decision on the status code. A file that is simply absent is read as no restrictions. A server that seems to be failing is read as a reason to stay away, because Google cannot know whether the missing rules would have blocked anything.
Each combination of protocol, host and port has its own file. https://example.com/robots.txt, https://www.example.com/robots.txt and https://shop.example.com/robots.txt are three separate files, and a broken one only affects its own host.
What Google does with each response
Google documents its handling in its robots.txt specification. In summary:
| Response to /robots.txt | What Google does | Urgency |
|---|---|---|
| 200 OK | Reads and follows the rules | None |
| 301, 302, 307, 308 | Follows at least five redirect hops, then treats the file as not found | Low, if the redirect ends at a 200 |
| 404, 410, 403, 401 and other 4xx except 429 | Treats it as if no robots.txt exists and crawls without restrictions | Low, unless you need rules |
| 429 Too Many Requests | Treated like a server error: site temporarily treated as fully disallowed | High |
| 500, 502, 503, 504 | Site temporarily treated as fully disallowed while Google keeps retrying | High |
| Timeout, DNS or connection failure | Treated as a server error | High |
If the file stays unreachable for more than 30 days, Google's documentation says it uses the last cached copy, or crawls without restrictions if it has no copy. That is not a safety net to rely on: a month of slow or stopped crawling means new pages are not found and changed pages are not refreshed.
Two details catch people out. First, a 403 on robots.txt is treated as no rules, which surprises owners who expected it to block crawlers. If you want to block crawling, return a 200 with Disallow rules. Second, Google only reads the first 500 KiB of the file and ignores anything after that, which can matter for very long generated files.
How to check the response
Request the file for every host you serve, including the bare domain and the www version, over both HTTP and HTTPS:
for u in http://example.com https://example.com http://www.example.com https://www.example.com; do
echo "== $u"
curl -sIL -o /dev/null -w "%{http_code} %{content_type} %{url_effective} %{time_total}s\n" "$u/robots.txt"
done
Each line should end in 200 text/plain at the address you expect, with a response time well under a second. Then repeat the request with a crawler user agent, because firewalls often treat it differently:
curl -sI -A "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" https://www.example.com/robots.txt
A firewall may treat a real Googlebot request, coming from Google's own IP addresses, differently from your test, so the curl result is a clue rather than proof. For the real picture, look at your access log for requests to /robots.txt and their status codes:
sudo grep '"GET /robots.txt' /var/log/nginx/access.log | grep -i googlebot | awk '{print $4, $9}' | tail -n 20
What Search Console shows
The robots.txt report, under Settings, lists the robots.txt files Google found for the top hosts in your property, when each was last crawled, the fetch status and any warnings or errors in the rules. You can ask Google to recrawl a file from the report after a fix. The Crawl stats report, also under Settings, shows host status with a robots.txt fetch check, which highlights periods when the file could not be fetched. For problems with the rules themselves rather than the fetch, see fixing robots.txt syntax.
The usual causes of fetch failures
| Cause | What you see |
|---|---|
| Bot protection or WAF challenging crawlers | 403 or 503 for crawler requests, challenge page instead of text |
| Rate limiting | 429 at busy times or during heavy crawling |
| Dynamic robots.txt from a CMS that is down or slow | 500, 502 or 504 whenever PHP or the application fails |
| Origin server overloaded | Timeouts and 503s across the site, robots.txt included |
| Redirect to the wrong place | robots.txt redirects to a login page, the home page or another domain |
| Single-page app fallback | robots.txt returns the app's HTML with status 200 |
| DNS problems on one host | One host fails completely while the others work |
The common thread is that robots.txt depends on something more fragile than it needs to. A static text file served directly by the web server or CDN is about as reliable as anything on the internet. The same file built on every request by PHP, a database and a plugin fails whenever any of those fail. Our server error (5xx) guide covers what to do when pages are failing too, not just this one file.
Serving a reliable robots.txt
If you have nothing to block, a minimal file is enough. It allows all crawling and tells crawlers where your sitemap is:
User-agent: *
Disallow:
Sitemap: https://www.example.com/sitemap.xml
Save it as UTF-8 plain text in the web root and let the web server serve it directly. In nginx, an exact-match location makes sure it never reaches the application:
location = /robots.txt {
try_files $uri =404;
default_type text/plain;
access_log off;
}
If a CMS generates the file and you want to keep that, put a short cache in front of it so a brief outage does not turn into a fetch failure. On Apache, a real robots.txt file in the document root is served before WordPress rewrite rules run, because those rules only apply when no file exists at the requested path.
Letting crawlers past the firewall
In Cloudflare, create a custom rule that matches the path /robots.txt and uses the Skip action for the security features that challenge bots, or at least skips them for verified bots where cf.client.bot is true. Check security events afterwards to confirm crawler requests for the file are no longer challenged. The same idea applies to other CDNs and hosting firewalls: robots.txt should never sit behind a challenge page. The AI crawler access guide covers allowing specific bots through Cloudflare more broadly.
A worked example
A small online shop switches on a bot protection service after a wave of scraping. Within two weeks, Search Console's Crawl stats show crawl requests falling to almost nothing, and new products are not appearing in search. The pages themselves load fine in a browser.
The robots.txt report shows recent fetch failures, and the access log on the origin shows no Googlebot requests for /robots.txt at all. The protection service is answering them at the edge with a challenge page and a 503 status. Google reads that as a server error and stops crawling the site.
The owner adds a rule allowing verified crawlers to fetch /robots.txt and the sitemap without a challenge, then uses the robots.txt report to request a recrawl. The next fetch succeeds with a 200, and over the following days Crawl stats show requests climbing back to their usual level. The scraping protection stays on for everything else.
The fix, step by step
Step 1
Request robots.txt on every host
Run curl -sIL on /robots.txt for the bare domain and the www version, over both HTTP and HTTPS, and for any subdomain that serves content such as a shop or CDN host. Note the final status code, content type, final address and response time for each. Every host should end in a 200 with text/plain. Any 5xx, 429 or timeout is the urgent problem, and should be fixed before anything else on this list.
Step 2
Check what Google saw
Open the robots.txt report under Settings in Google Search Console. Check the fetch status and last crawl time for each host, and note any failures. Then open Crawl stats, also under Settings, and look at host status for robots.txt fetch problems and when they started. Matching the start date to a change you made, such as a new firewall rule, hosting move or plugin update, usually points straight at the cause.
Step 3
Read the server logs for robots.txt
Search the access log for requests to /robots.txt from Googlebot and print the status codes. If the codes are errors, read the error log for the same times. If there are no Googlebot requests at all, the requests are being stopped before they reach your server, by a CDN, firewall or DNS problem, and the fix belongs there rather than in the site. Note the times and codes so you can compare after the fix.
Step 4
Let crawlers past the firewall
In Cloudflare or your bot protection service, open the security events log and filter for /robots.txt. If crawler requests are being challenged, blocked or rate limited, add a rule that skips those protections for that path, or for verified bots using cf.client.bot. Do the same for your sitemap. Retest with a crawler user agent and check the events log again to confirm crawler requests for the file now pass.
Step 5
Serve robots.txt as a static file
If a CMS or application builds robots.txt on the fly and fails when the application is slow, replace it with a real UTF-8 text file in the web root. In nginx, add an exact-match location = /robots.txt block with try_files $uri =404;, then run nginx -t and reload. On Apache the real file is served before rewrite rules apply. Confirm the file still loads with a 200 when the application is stopped.
Step 6
Fix wrong redirects and HTML responses
If robots.txt redirects to a login page, the home page or an app shell, or returns HTML with a 200, fix the rule that catches it. Exclude /robots.txt from login redirects, maintenance pages and single-page app fallbacks. Normal redirects between http, https, www and non-www are fine as long as they end at a 200 text file within a hop or two. Check the final response body starts with your first rule.
Step 7
Use a sensible minimal file
If you have nothing to block, publish User-agent: * followed by an empty Disallow: line and a Sitemap: line with your full sitemap address. This allows all crawling and points crawlers at your sitemap. Add Disallow rules only for paths that genuinely should not be crawled, such as internal search results. Load the live file in a browser to confirm it shows exactly what you saved and nothing else.
Step 8
Request a recrawl and monitor
In the robots.txt report, request a recrawl of each fixed file and check that the new fetch succeeds. Watch Crawl stats over the next week for crawl requests returning to their usual level. Add /robots.txt on each host to your uptime monitor with a check for a known line of text, so a future failure alerts you within minutes rather than showing up weeks later as falling traffic.
Edge cases worth knowing
- Pausing crawling on purpose. If you need Google to back off for a short time, such as during maintenance, Google recommends returning 503 for all URLs rather than blocking with robots.txt. Keep it short; a long run of errors slows crawling and can eventually affect indexing.
- Subdomains and CDNs. Images or files served from a separate host, such as
cdn.example.com, are governed by that host's robots.txt. A failing file there can stop Google crawling your images. - Redirect to a different host. Redirecting
http://example.com/robots.txttohttps://www.example.com/robots.txtis normal and works. Google follows the redirect and uses the rules it finds at the end. - Other crawlers. Bing and other search engines have their own handling, which is broadly similar but not identical. A file that returns 200 quickly works for all of them.
- Staging copies. A staging robots.txt with
Disallow: /copied to the live site is a rules problem, not a fetch problem, but it is common after launches. See fixing robots.txt blocks.
Keeping it fixed
- Add
/robots.txton each live host to your uptime monitor, checking for a 200 status and a known line of text such as your Sitemap line. - Whenever you add or change a firewall, bot protection or rate limiting rule, request robots.txt with a crawler user agent and check the security events log for crawler requests.
- Prefer a static file. If your CMS must generate it, cache it.
- Look at the robots.txt report and Crawl stats in Search Console once a month, and after any hosting change.
- Keep the file short and readable. The robots and sitemap guide explains which rules are worth having and which are not.
1. Is it bad if my site has no robots.txt file?
No, a missing robots.txt is not a problem for Google, which treats a 404 for the file as permission to crawl everything. Many small sites have no file and are crawled normally. The only downside is that you cannot block anything or point crawlers at your sitemap from it, though you can still submit the sitemap in Search Console. What matters is that the missing file returns a proper 404, not a 500 or a timeout.
2. What does robots.txt unreachable mean?
It means Google tried to fetch your robots.txt file and could not get a usable answer, usually because of a server error, a 429 rate limit response, a timeout or a DNS failure. Because Google cannot read the rules, it treats the site as temporarily blocked and holds back crawling. Pages that work for visitors may therefore stop being crawled. Check the file with curl, look at your logs and firewall events, and fix whatever is stopping the request from getting a 200 response.
3. Does a 403 on robots.txt block Googlebot?
No, Google treats a 403 on robots.txt the same as a 404 and crawls as if there were no restrictions. This surprises many owners. If you want to stop Google crawling part of your site, return the file with a 200 status and use Disallow rules. If a firewall returns 403 for robots.txt, it is probably also returning 403 for your pages, and that is the bigger problem, because Google cannot fetch pages that refuse it.
4. How long does Google cache robots.txt?
Google generally caches robots.txt for up to 24 hours, so a change can take up to a day to take effect. The cache can last longer if Google cannot fetch a fresh copy, for example during timeouts or server errors. You can speed things up after a fix by requesting a recrawl from the robots.txt report in Search Console. Other crawlers have their own caching periods, so allow for a delay before expecting all of them to follow new rules.
5. What happens if robots.txt returns a 500 error for a long time?
Google first treats the site as fully disallowed and keeps retrying the file, so crawling slows or stops. According to Google's documentation, if the file stays unreachable for more than 30 days it uses the last cached copy, or crawls without restrictions if it has none. In practice a month of reduced crawling means new and updated pages are missed, so a 5xx on robots.txt should be fixed as quickly as a site outage.
6. Should robots.txt be text/plain?
Yes, serving robots.txt as text/plain with UTF-8 encoding is the safest choice and what crawlers expect. Google parses the content it receives and ignores lines it cannot understand, so the bigger risk is not the content type itself but an HTML page served in place of the file, such as an error page or an app shell. A real static text file in the web root gets the right content type from almost any web server automatically.
7. Why does Cloudflare block Googlebot from robots.txt?
Cloudflare does not block verified Googlebot by default, but your own settings can, such as a custom rule, a country block, rate limiting, Under Attack mode or bot protection features. If any of these challenge the request, Google receives a challenge page with an error status instead of your file. Check the security events log for requests to robots.txt and add a rule that skips those protections for that path or for verified bots, then retest.
The robots and sitemap checker on aiwebpageseo.com fetches robots.txt for your domain, reports the status code and content type it gets back, and checks the rules and sitemap lines inside it.
Open Robots and Sitemap Fixes โ