Skip to content

SEOPart of: Broken links and status codes

500 Internal Server Error: causes and fixes for site owners

A 500 Internal Server Error means the server hit a problem it could not handle while building the page. What visitors can do, and how site owners find the cause and fix it.

getReport teamUpdated 4 Oct 202613 min read

A 500 Internal Server Error means the web server received the request but hit a problem it could not handle while building the page, so it sent an error instead. The address is right and the page usually exists; the code, configuration or resources behind it failed. This guide gives visitors the short version, then walks site owners through finding the cause in the error log and fixing it, and explains what 5xx errors do to your Google crawling. It belongs to the wider guide on broken links and the status codes behind them.

Quick answer

  • Visitor: reload after a minute, try again later, and tell the site if it lasts. Nothing on your device causes a 500.
  • Site owner: the error log names the cause. Read it before you change anything.
  • Most common causes: a plugin or code error, a bad .htaccess or server rule, PHP running out of memory, wrong file permissions, or a database that does not answer.
  • On WordPress, turn on the debug log, or deactivate plugins by renaming the plugins folder, to find the one that fails.
  • Errors that come and go usually mean the server runs out of workers or memory under load.
  • For planned downtime, answer 503 with a Retry-After header, not 500 and not a 200 "back soon" page.
  • Short outages do not cost rankings; pages that keep returning 5xx are eventually dropped from Google's index.

What does a 500 Internal Server Error mean?

Every server answer carries an HTTP status code. Codes starting with 5 mean the server failed to fulfil a valid request, and 500 is the generic one: RFC 9110, the HTTP standard, defines it as an unexpected condition that prevented the server from fulfilling the request. The server knows something broke but either cannot or will not say what, which is why the page you see is usually vague.

The wording varies by server and browser: "Internal Server Error", "HTTP ERROR 500", "This page isn't working", "The server encountered an internal error or misconfiguration", or on WordPress "There has been a critical error on this website." They all point to the same place: the server side. That is the difference from a 404 error, where the server works fine but has no page at the address.

500, 502, 503 and 504

The other 5xx codes narrow down where the failure is:

CodeNameUsually means
500Internal Server ErrorThe application or a server rule failed while building the page
502Bad GatewayA proxy, load balancer or CDN got an invalid answer from the server behind it, often because PHP-FPM or the app crashed
503Service UnavailableThe server is overloaded or in maintenance and says so on purpose
504Gateway TimeoutA proxy or CDN waited for the server behind it and gave up

Behind Cloudflare you may also see its own 52x codes. 521 means your server refused the connection, 522 that the connection timed out, and 524 that your server accepted the connection but did not answer within Cloudflare's default 100-second limit. They all point at your origin server, not at Cloudflare.

If you're a visitor: what you can do

A 500 is the website's problem, not yours. Your browser, connection and device are fine.

  1. Reload after a minute. Many 500s are momentary, during an update or a traffic spike.
  2. Try again later. If the site is being fixed, it will be back.
  3. Don't resubmit payments or forms blindly. If the error appeared after you paid or ordered, check your email or account for a confirmation before trying again.
  4. Tell the site owner if the error lasts, with the address and the time you saw it.

If you own the site: find the cause

A 500 page is deliberately vague for visitors, so the diagnosis happens in the logs.

Read the error log first

Where to look:

  • Apache: /var/log/apache2/error.log on Debian and Ubuntu, /var/log/httpd/error_log on Red Hat-based systems.
  • nginx: /var/log/nginx/error.log, plus the PHP-FPM log when PHP is involved.
  • Shared hosting: the control panel's "Errors" or "Error log" section, often per domain.
  • Managed platforms such as Netlify, Vercel or a managed WordPress host: the function or site logs in the dashboard.

Reload the failing page, then look at the newest lines. The message usually names the file and line, the directive or the resource that failed: "PHP Fatal error: Uncaught Error: Call to undefined function", "Invalid command 'RewriteEngin'", "Allowed memory size of 134217728 bytes exhausted".

Match the log to a cause

What the log saysCauseFix
PHP Fatal error in a plugin or theme fileA code error, often after an updateDeactivate or roll back that plugin or theme
"Invalid command" or ".htaccess: … not allowed here"A typo or unsupported directive in .htaccessUndo the last .htaccess change or restore a backup
"Allowed memory size … exhausted"PHP ran out of memoryFix the code that uses it, or raise memory_limit
"Permission denied"The server cannot read or run a fileReset permissions: typically 644 for files, 755 for folders
"Error establishing a database connection" or a MySQL errorThe database is down, full or has wrong credentialsCheck the database server and the credentials in the config
Nothing, or timeouts under loadToo few PHP workers or too little memory for the trafficAdd caching, raise workers, or move to a bigger plan

If the error started right after a change, the change is the prime suspect: a plugin update, a PHP version switch, a new redirect rule. Undoing it is the fastest test.

500 Internal Server Error on WordPress: how to fix it

On WordPress, a 500 almost always comes from one of four places: a plugin or the theme, the .htaccess file, the PHP memory limit, or a PHP version the code does not support. The debug log tells you which. WordPress has two built-in helpers. Since version 5.2, a fatal error in a plugin or theme shows "There has been a critical error on this website" and emails the admin address a link to recovery mode, which lets you log in with the failing extension paused.

If no email arrives, turn on the debug log in wp-config.php, above the line that says "That's all, stop editing":

PHP
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );

Reload the page and read wp-content/debug.log. Switch the three lines off again once you have the answer: debug.log is readable by anyone who guesses the address, so delete it when you are done. The fix page on exposed files explains why files like it matter.

Without admin access, deactivate every plugin at once by renaming wp-content/plugins to plugins-off over SFTP or the host's file manager. If the site comes back, rename the folder back and deactivate plugins one by one in the admin until the error returns. Do the same with the active theme's folder; WordPress falls back to a default theme if one is installed.

Three more WordPress causes are common. A corrupted .htaccess: rename it, then go to Settings → Permalinks and click Save Changes to write a fresh one. A PHP version switch at the host that an old plugin does not support: switch back, update the plugin, then try again. And PHP running out of memory, which the log reports as "Allowed memory size … exhausted": raise WordPress's limit in wp-config.php, above the same "stop editing" line:

PHP
define( 'WP_MEMORY_LIMIT', '256M' );

WordPress's documentation on editing wp-config.php gives the default as 40 MB for a single site and 64 MB for multisite, and notes that some hosts do not let PHP raise its own limit; if the error stays, ask the host to raise memory_limit. A higher limit buys time, so also find what needs that much memory, usually one plugin, an import or image processing.

Errors that come and go

A 500, 502 or 504 that appears only at busy times, or only on some requests, is usually a capacity problem rather than a bug. Shared hosting limits how many PHP processes run at once; when they are all busy, new requests fail or time out. Slow uncached pages, heavy search or filter pages, and bots crawling hard make it worse.

The fixes are the same as for a slow server: full-page caching so most requests never reach PHP, an object cache for the database, fewer heavy plugins, and blocking abusive bots. Server response time on shared hosting and TTFB: what a slow server looks like cover the diagnosis; if the host cannot give you the workers you need, a bigger plan or another host is the fix.

What 5xx errors do to SEO

Google's documentation on HTTP status codes and Google Search describes the behaviour. When a site returns 500, 502 or 503, Google lowers its crawl rate for the site, roughly in proportion to how many URLs fail. Pages already in the index are kept at first, and URLs that keep returning server errors are eventually dropped.

So a short outage does not cost rankings, and a long one does. Search Console shows the damage under Indexing → Pages as "Server error (5xx)", and the Crawl stats report under Settings shows the share of requests that failed.

Two special cases matter:

  • robots.txt returning 5xx. Google's robots.txt documentation says it then stops crawling the whole site for the first 12 hours, and for up to 30 days uses the last copy it could fetch. A broken robots.txt can halt crawling even while pages work.
  • Planned maintenance. Answer 503 Service Unavailable with a Retry-After header, so browsers and crawlers know it is temporary and when to come back. WordPress answers 503 on its own while it installs core and plugin updates. A maintenance page that answers 200 tells Google your content has been replaced by "back soon".

On nginx, a simple maintenance switch looks like this, in the server block:

nginx
# Serve maintenance.html with 503 while the file maintenance.on exists
if (-f $document_root/maintenance.on) {
    return 503;
}
error_page 503 /maintenance.html;
location = /maintenance.html {
    add_header Retry-After 3600 always;
    internal;
}

How to check for 500 errors

  • One page: run a getReport report on it. The indexability finding reports the HTTP status the page answered, and the server response time finding flags a slow back end.
  • Many pages: paste your sitemap URLs or top pages into the bulk URL checker and filter to "server error". Run it again at a busy time of day to catch errors that come and go.
  • The links on a page: the broken link checker lists 5xx answers among the links, so you see which pages behind your menu fail.
  • Over time: Search Console's "Server error (5xx)" group and your server logs. The log analyser shows the status codes each bot received, in your browser, without uploading the log.

A 5xx on someone else's site in your link check is a reason to re-check later, not to remove the link; it is often gone the next day.

Common mistakes

  • Showing the error details to visitors. WP_DEBUG_DISPLAY or display_errors on a live site prints file paths and code to everyone. Log errors; don't display them.
  • Leaving debug.log in place. It keeps growing and stays public until you delete it.
  • Answering 200 on an error page. Some setups catch the failure and show a friendly page with status 200, so Google indexes the error text.
  • Changing several things at once. Undo one change at a time and reload, or you will not know which one fixed it.
  • Blaming the CDN. 502, 504 and Cloudflare's 52x pages appear at the edge, but the cause is almost always the server behind it.

Questions people ask

What does 500 Internal Server Error mean?

It means the server received a valid request but failed while building the answer, because of an error it did not expect. The cause is on the website's side: a code or plugin error, a broken server rule, missing permissions, or too little memory. The server's error log names the exact problem; the page visitors see is deliberately vague.

Is a 500 Internal Server Error my fault as a visitor?

No, a 500 is caused by the website's server, not by your browser, device or connection. Reload after a minute, since many are momentary, and try again later if it persists. If the error appeared after a payment or order, check your email for a confirmation before submitting again, and tell the site owner if it lasts.

How do I fix a 500 error in WordPress?

Check the admin email for a recovery mode link first, then turn on WP_DEBUG_LOG and read wp-content/debug.log for the failing plugin or theme. Without admin access, rename the plugins folder to deactivate them all, and reactivate them one by one. A corrupted .htaccess or a PHP version switch at the host are the other usual causes.

What is the difference between 500, 502, 503 and 504 errors?

A 500 means the application itself failed. A 502 means a proxy or CDN got an invalid answer from the server behind it, and a 504 that it gave up waiting. A 503 is a deliberate "unavailable for now", used for overload or maintenance. All four are server-side and are treated alike by Google for crawling.

Do 5xx server errors hurt SEO?

Only if they last. Google slows its crawling when a site returns server errors and keeps already-indexed pages at first, but URLs that keep answering 5xx are eventually dropped from the index. Fix outages quickly, answer 503 with Retry-After for planned maintenance, and watch the "Server error (5xx)" group in Search Console.

Why does my site show 500 errors only at busy times?

Because the server runs out of capacity rather than hitting a bug. Shared hosts limit the number of PHP workers and the memory available; when every worker is busy, new requests fail or time out. Full-page caching, fewer heavy plugins and blocking abusive bots reduce the load; if not, the plan is too small.

Check your site before and after Check