/ โ† Robots and Sitemap Fixes / robots.txt unreachable
In this guide
  1. Why the robots.txt response matters so much
  2. What Google does with each response
  3. How to check the response
  4. The usual causes of fetch failures
  5. Serving a reliable robots.txt
  6. A worked example
  7. The fix, step by step
  8. Edge cases worth knowing
  9. Keeping it fixed
  10. Questions and answers

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.

๐Ÿ’ก Treat robots.txt as part of your uptime monitoring. A problem with this one small file can affect the crawling of every page on the host.

What Google does with each response

Google documents its handling in its robots.txt specification. In summary:

Response to /robots.txtWhat Google doesUrgency
200 OKReads and follows the rulesNone
301, 302, 307, 308Follows at least five redirect hops, then treats the file as not foundLow, if the redirect ends at a 200
404, 410, 403, 401 and other 4xx except 429Treats it as if no robots.txt exists and crawls without restrictionsLow, unless you need rules
429 Too Many RequestsTreated like a server error: site temporarily treated as fully disallowedHigh
500, 502, 503, 504Site temporarily treated as fully disallowed while Google keeps retryingHigh
Timeout, DNS or connection failureTreated as a server errorHigh

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.

โš ๏ธ A robots.txt that redirects to your home page or returns an HTML error page with status 200 is read as a text file full of invalid lines. Google ignores lines it cannot parse, so the effect is usually no rules at all, which may not be what you intended.

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

CauseWhat you see
Bot protection or WAF challenging crawlers403 or 503 for crawler requests, challenge page instead of text
Rate limiting429 at busy times or during heavy crawling
Dynamic robots.txt from a CMS that is down or slow500, 502 or 504 whenever PHP or the application fails
Origin server overloadedTimeouts and 503s across the site, robots.txt included
Redirect to the wrong placerobots.txt redirects to a login page, the home page or another domain
Single-page app fallbackrobots.txt returns the app's HTML with status 200
DNS problems on one hostOne 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

Keeping it fixed

Questions and answers

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.

Check your robots.txt on every host

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 โ†’
๐Ÿ’ฌ Got a problem?
Related Guides: All Robots and Sitemap Fixes  ·  How to edit robots.txt in WordPress and Cloudflare  ·  How to fix robots.txt syntax  ·  How to fix robots.txt blocks  ·  Search Console server error (5xx)  ·  Learning Hub

About aiwebpageseo

aiwebpageseo.com is a data-driven SEO and AEO (Answer Engine Optimisation) platform providing a free suite of technical SEO tools. Rather than relying on AI-theorised assumptions, the platform analyses live URL performance, delivering objective diagnostics, page speed metrics, CLS debugging, and site crawl data alongside actionable technical tutorials.