Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Robots.txt returns 5xx: how to find and fix it

OPS-098Medium impactCould addBy FunnelGuardPublished Updated
On this page

What this issue is

robots.txt is a small text file at the root of your site (for example https://example.com/robots.txt). It tells search engine crawlers which URLs they may visit. Crawlers request it before they crawl anything else.

A 5xx status code means the server failed to answer properly. Common ones are 500 (internal error), 502 (bad gateway), 503 (service unavailable) and 504 (timeout). If robots.txt returns one of these, the crawler cannot tell what it is allowed to visit.

Google's documented behaviour is cautious. While robots.txt returns a server error, Google stops crawling the site. If the error lasts for a long time, it may fall back to the last good copy of the file, and after that it may act as if no restrictions exist. A missing file (404) is treated differently: it means everything may be crawled.

How crawlers generally read each robots.txt response
ResponseWhat it means to a crawlerRisk
200 with valid rulesFollow the rulesNone
404 / 410No rules, crawl everythingLow
5xx or timeoutCannot tell, crawling is paused or limitedHigh
Redirect loopTreated as an errorHigh

Why it costs you leads or sales

Search engines send visitors to your landing pages, product pages and forms. If crawling stops, new pages are not discovered, changed prices and stock are not refreshed, and pages can slowly drop out of results. Organic leads and sales fall, and the cause is easy to miss because the site itself looks fine to people.

How a broken robots.txt leads to lost traffic
  1. Crawler requests robots.txtFirst request on every crawl
  2. Server returns 5xxPlugin, proxy or server fault
  3. Crawling pausedNew and changed pages not fetched
  4. Rankings and traffic slipFewer organic leads and sales

The site works for visitors, but crawlers are stopped at the first request.

How to check if your site has it

Check your robots.txt status
  1. Open the file in a browser

    Visit https://yourdomain.com/robots.txt. You should see plain text rules, not an error page.

  2. Read the real status code

    A browser can hide the code. Run the curl command below, or use your browser's developer tools (Network tab).

  3. Check both www and non-www, and http and https

    Each version can behave differently, especially after a migration or CDN change.

  4. Look in Google Search Console

    Open Settings, then Crawl stats, then the robots.txt section (also shown as Hosts). It lists fetch status for recent days. The Page indexing report may also show pages blocked or not fetched.

  5. Check your server logs

    Search the access and error logs for requests to /robots.txt that returned 5xx, and note the times.

Show the status code and headersbash
curl -I https://yourdomain.com/robots.txt

# Pretend to be Googlebot (for testing your own site only)
curl -I -A "Googlebot" https://yourdomain.com/robots.txt

How to fix it

The aim is simple: /robots.txt should always return 200 with valid rules, or a clean 404 if you do not want one. The cause depends on your setup, so work through the common ones.

Find and remove the cause
  1. Find the failing layer

    Compare the response from your origin server with the one through your CDN or proxy. If only the CDN returns 5xx, the fault is in the CDN or its link to the origin.

  2. Check the error log

    A 500 usually leaves a PHP or server error. A 502 or 504 points to a crashed or overloaded backend, such as PHP-FPM or an upstream app.

  3. Disable recent changes

    Switch off the SEO plugin, security plugin, caching rule or rewrite rule you changed last, then retest.

  4. Serve a real file

    Upload a static robots.txt to the web root so no application code is needed to answer the request.

  5. Clear caches

    Purge the CDN, server and plugin caches so an old error response is not still being served.

  6. Retest and request a recrawl

    Confirm 200 with curl, then use the robots.txt report in Search Console to request a recrawl of the file.

Platform-specific fixes
  1. Test with a physical file

    WordPress creates a virtual robots.txt when no file exists. Upload a real robots.txt to the site root via SFTP or your host's file manager to bypass PHP.

  2. Check SEO and security plugins

    Yoast, Rank Math, All in One SEO and security plugins can edit robots.txt. Deactivate them one at a time and retest.

  3. Check .htaccess

    Rename .htaccess temporarily. If robots.txt works, regenerate it under Settings, then Permalinks, then Save.

  4. Raise PHP limits if needed

    If logs show memory or timeout errors, ask your host to raise memory_limit or check PHP-FPM workers.

Serve robots.txt directly from disk in nginxnginx
location = /robots.txt {
    root /var/www/example.com/public;
    try_files $uri =404;
    access_log off;
}
A minimal valid robots.txttext
User-agent: *
Disallow: /wp-admin/
Allow: /wp-admin/admin-ajax.php

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

How to confirm it's fixed

Confirm the fix
  • curl -I returns 200 (or a deliberate 404) for /robots.txt
  • The same result on www, non-www, http and https
  • The same result with a Googlebot-style user agent
  • The response is not served from a stale CDN cache
  • Search Console robots.txt report shows a successful fetch
  • Crawl stats show no new robots.txt server errors over the next few days
  • The file does not contain an accidental 'Disallow: /'

Google re-fetches robots.txt often, but it caches the result for up to about a day. Recovery of normal crawling can take a few days, so keep checking Crawl stats.

How to prevent it happening again

Example: how an unnoticed robots.txt error unfolds
  1. Day 1, 02:00

    A plugin update breaks the code that generates robots.txt, which now returns 500.

  2. Day 1, 09:00

    The site looks fine to staff, so nobody notices.

  3. Day 3

    Search Console starts reporting robots.txt fetch failures and crawling slows.

  4. Day 6

    Someone spots it, serves a static file and requests a recrawl.

Prevention habits
  • Serve robots.txt as a static file where you can
  • Monitor /robots.txt with an uptime tool that alerts on any non-200 status
  • Turn on Search Console email alerts and review Crawl stats monthly
  • Test robots.txt after plugin, theme, CDN and hosting changes
  • Keep a copy of your known good file in version control or a backup
  • Make sure firewall and rate limit rules do not block crawlers
  • Size your server so PHP workers do not run out under crawl load

How FunnelGuard handles this

FunnelGuard does not check robots.txt today. It is a possible future check, not a current feature.

What FunnelGuard does do is run your real customer journeys (lead forms, checkouts, booking and chat buttons) on a schedule from the EU or the US, check each step and the tracking hits sent to ad and analytics platforms, and re-check a failure from a second region before sending one alert. If a server problem is also breaking a page or form your visitors use, that journey check can show it. It will not tell you that crawlers are being refused.

To watch for this issue now, use Search Console (Crawl stats and the robots.txt report), add an uptime monitor on your robots.txt URL that alerts on any non-200 response, and review your server logs. You can also start with the free FunnelGuard plan (1 site, 2 journeys, daily checks, no card) to cover your key journeys while you do that.

Questions people ask

What happens if robots.txt returns a 500 error?

Google treats a 5xx robots.txt as a sign it cannot tell what it may crawl, so it pauses or limits crawling of the site. If the error lasts a long time, it may use an older cached copy or eventually assume there are no restrictions. Fix it quickly to avoid slower discovery of new pages.

Why is Google Search Console saying robots.txt is unreachable?

It means Google tried to fetch the file and got a server error, a timeout or a blocked connection. Check the status with curl, review your server and error logs, and test with a Googlebot-style user agent, since firewalls sometimes block bots only.

Is it better for robots.txt to return 404 than 5xx?

Yes. A 404 tells crawlers there are no rules, so they crawl normally. A 5xx tells them something is wrong, which can stop crawling. Ideally you serve a valid 200 file with a sitemap line.

How do I check my robots.txt status code?

Run curl -I https://yourdomain.com/robots.txt in a terminal, or open your browser's developer tools and look at the Network tab. You want to see 200. Also test www, non-www, http and https versions.

How long does it take Google to recover after I fix robots.txt?

Google caches robots.txt for up to about a day, so it may take that long to notice the fix. You can request a recrawl of the file in Search Console. Normal crawling usually returns over the following days.

Why does my robots.txt work for me but fail for Googlebot?

A firewall, CDN, security plugin or rate limit may block or error on bot traffic only. Test with a Googlebot-style user agent and check your firewall logs. Do not disable security fully; adjust the rule that catches crawlers.

Can a WordPress plugin cause a robots.txt 5xx error?

Yes. WordPress builds a virtual robots.txt in PHP, and SEO or security plugins can edit it. A plugin fault can return a 500. Uploading a real robots.txt file to the site root removes PHP from the request.

Does FunnelGuard monitor robots.txt?

Not yet. It is a possible future check. FunnelGuard monitors your customer journeys, tracking and lead delivery, so use Search Console and an uptime monitor for robots.txt for now.

Does FunnelGuard catch this?

Could add

Not checked yet: could be added to FunnelGuard.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.