500 Internal Server Error: find the cause and fix it
500 Internal Server Error is the generic response when server-side code or configuration fails; the cause is always in the error log.
500 Internal Server Error is the server’s generic “something broke” response. The request was fine; the code or configuration that should have answered it failed. Because it’s a catch-all, a 500 tells you almost nothing about the cause, and the answer is nearly always in the server’s error log.
Definition
RFC 9110, section 15.6.1 says the server “encountered an unexpected condition that prevented it from fulfilling the request.” More specific 5xx codes exist for gateways (502, 504) and for temporary unavailability (503); 500 covers everything else.
Common causes
- Code errors: uncaught exceptions, PHP fatal errors, syntax errors in a fresh deploy.
- Resource limits: “Allowed memory size exhausted,” execution time limits, a full disk.
- A broken .htaccess: an invalid or unsupported directive makes Apache return 500 for every request in that folder.
- Plugin or theme conflicts after an update; WordPress then shows “There has been a critical error on this website.”
- Database or service failures the application doesn’t handle gracefully.
- Wrong permissions or missing environment variables after a migration.
SEO impact
Per Google’s HTTP status code documentation, 5xx errors make Googlebot slow its crawling of the site, in proportion to how many URLs are failing. Pages already in the index are kept for a while, but URLs that return server errors persistently are removed. A short blip costs little; days of errors on important pages cost rankings.
robots.txt deserves special care. If it returns a 5xx, Google temporarily treats the whole site as disallowed. If that lasts more than 30 days, Google falls back to its last cached copy, or assumes no restrictions if it has none. Search Console shows these problems under “Server error (5xx)” in the Page indexing report and in the host status section of Crawl Stats.
How to fix a 500
For site owners
- Think about what changed last (an update, a new plugin, an edited file) and undo it.
- On WordPress, disable all plugins by renaming the
wp-content/pluginsfolder over FTP, then re-enable them one by one. - Ask your host for the error log entries from the time of the failure.
For developers
Read the logs first:
tail -f /var/log/nginx/error.log
tail -f /var/log/apache2/error.log
journalctl -u php8.3-fpm --since "10 min ago"
On WordPress, log errors without showing them to visitors:
// wp-config.php
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true); // writes wp-content/debug.log
define('WP_DEBUG_DISPLAY', false);
Never print stack traces on production pages (display_errors = Off). For known temporary failures, such as a database that’s restarting, return 503 with Retry-After instead of 500 so crawlers know to come back.
How to check
After every deploy, test one URL of each key template (home, category, article, product) with the HTTP status checker; a single bad template can break thousands of pages at once. For a wider view, a website SEO audit crawl surfaces errors across the site. A typical response:
HTTP/1.1 500 Internal Server Error
Content-Type: text/html; charset=UTF-8
Cache-Control: no-store
Content-Length: 2671 Frequently asked questions
Does a 500 error hurt SEO?
A brief one doesn’t do lasting harm: Googlebot slows down and comes back. Persistent 500s on the same URLs lead Google to drop them from the index, so fix them quickly.
Why do I get a 500 error on only some pages?
Those pages probably use a template, plugin, query or piece of data that fails. Compare a broken page with a working one and check the error log entries for the broken URL.
How long before Google drops pages that return 500?
Google doesn’t publish an exact time. Its guidance treats errors lasting hours or a day or two as a temporary slowdown, while URLs that keep failing for longer are gradually removed.