Server error (5xx): finding what broke when Googlebot asked for the page

"Server error (5xx)" means your server failed while answering Googlebot: it returned a 500-range status instead of the page. The fix is server-side. Find the failing request in your error log, repair the PHP error, resource limit or gateway timeout behind it, then ask Google to recrawl.

A 5xx seen once during a deploy is noise. A 5xx that repeats is the most damaging status in the report, because Google both drops the affected URLs over time and slows its crawling of the whole host when errors pile up.

What each code is telling you

  • 500 Internal Server Error. The application crashed. On WordPress this is nearly always a PHP fatal error in a plugin or theme, or an invalid .htaccess rule.
  • 502 Bad Gateway / 504 Gateway Timeout. A proxy in front of PHP (nginx, a load balancer or a CDN) got no usable answer from the origin in time. Slow database queries and exhausted PHP workers are the usual reasons.
  • 503 Service Unavailable. The server refused on purpose: maintenance mode, a rate limit or an overloaded host. WordPress sends a 503 with Retry-After: 600 while a .maintenance file exists during updates.
  • 508, 520–530 and similar. Host- or CDN-specific codes for resource limits and unreachable origins.

Reproduce it before changing anything

The page often loads fine for you, because you hit a cached copy or a quiet moment. Check three places:

  1. URL Inspection → Test live URL. If the live test succeeds, the error was intermittent and the question becomes when it happens.
  2. Settings → Crawl stats. Open the By response table and select Server error (5xx) for example URLs with timestamps. The Host status section shows whether server connectivity failed recently.
  3. Your server logs. Match those timestamps in the access log, then read the PHP error log for the same minute.

To see uncached behaviour from the command line:

code
curl -s -o /dev/null -w "%{http_code} %{time_total}s\n" -A "Googlebot" "https://example.com/page/?nocache=1"

WordPress causes and their fixes

  1. PHP fatal errors. Add define( 'WP_DEBUG', true ); and define( 'WP_DEBUG_LOG', true ); to wp-config.php, with WP_DEBUG_DISPLAY set to false, then read wp-content/debug.log. The entry names the file and line. Update, replace or deactivate the plugin responsible.
  2. Memory exhaustion. "Allowed memory size exhausted" in the log means a request needed more than PHP allows. Raise the limit with your host, and look for the plugin loading far more data than it should.
  3. A stuck maintenance file. If an update was interrupted, delete .maintenance from the site root.
  4. Too few PHP workers. Bursts of uncached requests queue up and time out as 502 or 504. Full-page caching for anonymous visitors is the cheapest fix; more workers is the paid one.
  5. Crawler load. Parameter URLs, calendar pages and internal search results can be requested by the thousand, each one uncached. Cut the URL space so bots stop reaching it; too many URL parameters explains how.
  6. Broken .htaccess. A 500 on every URL immediately after a plugin or permalink change points here. Restore the default WordPress block and re-save permalinks.

Planned downtime

If you must take the site offline, return 503 with a Retry-After header, not a 200 page that says "back soon" and not a 404. A 503 tells crawlers to come back later and keeps existing URLs indexed for short outages. Keep it short: Google's documentation warns that URLs returning 5xx persistently are eventually removed from the index.

Proving it is fixed

Watch the 5xx line in Crawl stats flatten for several days rather than relying on one successful page load. Then open the status in the Page indexing report and click Validate fix; Google rechecks the listed URLs over the following days and reports pass or fail. Our free SEO audit reports slow responses for a single URL, which is a useful early sign of a server close to its limits, but it cannot see errors that only occur under crawl load.

Common questions

Will a few 5xx errors hurt rankings?

Isolated errors are retried and forgotten. Repeated ones lead to slower crawling and, if they persist, removal of the affected URLs until they respond normally again.

The URL works in my browser. Why does Google say 5xx?

The failure is usually intermittent, load-related, or specific to uncached requests. A firewall that answers bots with a 5xx is another possibility; test with a Googlebot user agent and check your security logs.

Should I block Googlebot to reduce load?

No. Blocking hides the symptom and stops indexing. Reduce the number of worthless URLs it can reach and cache the rest.

Does a 503 during a WordPress update matter?

Not at normal update length. The response lasts seconds and includes Retry-After. It only matters if a failed update leaves the maintenance file in place.