Nexura WordPress Security Plugin Logo
Download Free

100% Free · No credit card required

Server Error Guide

How to Fix
5xx Server Errors

Seeing a 500 Internal Server Error or a 503 Service Unavailable? These server-level errors can crash your site and hurt your SEO. Learn exactly how to diagnose and resolve them.

Understanding 5xx Errors

Unlike 4xx errors (like 404 Not Found), which are caused by the client requesting a bad URL, 5xx errors mean the problem is on the server's end. Your browser requested a valid page, but the web server failed to fulfill the request.

  • 500 Internal Server Error: A catch-all error. The server encountered an unexpected condition. It usually points to a corrupted .htaccess file, bad file permissions, or an exhausted PHP memory limit.
  • 502 Bad Gateway: The server, acting as a gateway or proxy, received an invalid response from an inbound server (often an issue with caching layers like Cloudflare or Nginx).
  • 503 Service Unavailable: The server is currently unable to handle the request due to temporary overloading or maintenance. If you are not running maintenance mode, this usually means a bad script is eating up all server resources.

How to Fix 500 Internal Server Errors

Step 1

Regenerate Your .htaccess File

A corrupted .htaccess file is the #1 cause of the 500 error in WordPress.

  1. Access your site using FTP or your host's File Manager.
  2. Find the .htaccess file in the root folder (where your wp-content folder is). You may need to enable "Show hidden files".
  3. Rename the file to .htaccess_old.
  4. Try reloading your website. If it works, the file was corrupted.

To generate a new, clean .htaccess file, simply log into your WordPress admin, go to Settings > Permalinks, and click the Save Changes button without altering anything.

Step 2

Check File and Folder Permissions

Incorrect permissions can stop the server from executing scripts. Your files and folders must follow standard WordPress security permissions.

  • Folders should be set to 755 or 750.
  • Files should be set to 644 or 640.
  • wp-config.php can be set to 440 or 400 for extra security.

How to Fix 503 Service Unavailable

Step 3

Disable Problematic Plugins

If a plugin contains a "heavy" script (like a massive database query) that gets stuck in an infinite loop, your server will eventually throw a 503 error as it runs out of PHP workers.

  1. Connect to your site via FTP.
  2. Navigate to /wp-content/ and rename the plugins folder to plugins_old.
  3. If the site loads again, rename the folder back to plugins and start deactivating them one by one to find the culprit.
Step 4

Limit the WordPress Heartbeat API

The Heartbeat API sends continuous requests to the server while you are logged into the dashboard (for autosaving, post locking, etc.). If you leave your dashboard open in a tab, this can simulate a DDoS attack and cause a 503 error.

You can limit or disable the Heartbeat API by adding this code to your theme's functions.php file:

add_action( 'init', 'stop_heartbeat', 1 );
function stop_heartbeat() {
    wp_deregister_script('heartbeat');
}

Stop Hackers from Crashing Your Server

Many 503 errors are caused by malicious bots brute-forcing your login page or executing DDoS attacks. Nexura Security blocks bad bots automatically.

Secure Your WordPress Site

Stay Ahead of Hackers

Join our growing community of site owners who receive our weekly WordPress security alerts, vulnerability reports, and hardening tips.

SSL Secured
Privacy-focused
WP.org Verified
Proactive Defense
Secure Your Infrastructure Today