500 Internal Server Error on WordPress

PlatformWordPress Doing it yourself20 to 60 minutes Checked

The short answer

A 500 error means the server failed while building the page and will not say why on screen. The reason is written in the server error log. On WordPress it is usually a broken .htaccess file, a plugin, too little memory, or wrong file permissions.

Is this your problem?

  • A plain "500 Internal Server Error" or "HTTP ERROR 500" page
  • Only wp-admin fails, or only the front of the site
  • It appeared after installing a plugin, or after a move

What usually causes it

1
A damaged or edited .htaccess file

How to tell: Common after a security or redirect plugin writes rules, or after a move between hosts.

2
A plugin or theme error with error display turned off

How to tell: The log mentions a file in wp-content/plugins or wp-content/themes.

3
PHP running out of memory or time

How to tell: The log mentions memory exhausted, or maximum execution time.

4
Wrong file permissions

How to tell: After a move or a manual upload. Some hosts refuse to run files that anyone can write to.

Before you touch anything

  • Back up the site, or download .htaccess and wp-config.php before changing them.

How to fix it, step by step

  1. 1

    Read the server error log first

    This saves the most time. In cPanel it is under Metrics, then Errors, or a file called error_log in the site folder. On other hosts, ask support for the PHP and web server error log around the time of the error.

  2. 2

    Reset .htaccess

    Rename .htaccess in the site folder to .htaccess-old. If the site loads, log in, go to Settings, then Permalinks, and press Save to write a fresh one. A clean WordPress .htaccess looks like this.

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress
  3. 3

    Switch plugins off from the file manager

    Rename wp-content/plugins to plugins-off. If the site returns, rename it back and turn plugins on one at a time until the error comes back.

  4. 4

    Raise the memory limit

    Add this to wp-config.php. If the log still says memory exhausted, ask the host to raise PHP memory_limit.

    define( "WP_MEMORY_LIMIT", "256M" );
  5. 5

    Fix permissions

    Folders should be 755 and files 644. wp-config.php can be 640 or 600. Many file managers can set this, or ask your host to reset them.

Stop and get help if

  • The .htaccess file contains redirects to other websites you did not add.
  • The server is nginx and you do not have access to its settings. That needs the host.
  • The error log is full of requests to files you do not recognise.
Fix it for me

Stop it happening again

  • Keep a copy of a working .htaccess.
  • Install plugins one at a time on a copy of the site first.
  • Check the error log once a month, before small warnings become outages.

Questions people ask

Is a 500 error my fault or the host?

Either. The error log decides it. Plugin and .htaccess problems are on the site side, a server fault is on the host side.

Will clearing my browser cache fix it?

No. A 500 comes from the server, not your browser.

Still broken? We can fix it.