error 500 wordpress

How to Fix Internal Server Error 500 in WordPress

Last Updated on April 24, 2022 by WP Knowledge Hub

The dreaded 500 error, otherwise known as Internal server errors in WordPress are always bad news for WordPress developers because they provide no actual info on how to solve the problem and are rarely real server errors. If you have other websites on the same server, odds are the other websites are not affected.

That being said, where do you even start troubleshooting this error?

WordPress 500 internal server error

First, there’s no real indication as to what really went wrong and caused the internal Server Error 500. It’s quite disheartening. It’s definitely one of the trickier WordPress problems to solve. Good thing it’s pretty uncommon! But if you’re here, odds are you don’t care about that since it happened to you! 🙁

The only thing that’s a certainty in this scenario is that the error is caused by an operation on the WordPress website that went wrong somewhere.

How to Troubleshoot the 500 internal server error

Option 1. Turn on WordPress’ debugging feature

You can turn debugging on by adding a line of code to your site’s .wp-config file. Once you’ve accessed this file, search for WP_DEBUG line, usually at the bottom of the file. When you find it, you’ll want to set it to true, like so:

define( "WP_DEBUG", true );

Save the file if you are editing it, or re-upload it if you are changing it locally. After refreshing your website, hopefully the 500 error will be gone and the actual error will appear, and you can start to make sense of what went wrong.

If nothing happens, try option 2.

Option 2. Deactivate plugins and change themes

Since you probably don’t have access to the Dashboard Admin area of your WordPress website anymore, you will need to deactivate all your website’s plugins from the server. To do this, log into the server through your File Manager or FTP client (same as above), and open the folder called wp-content in your server’s root directory.

Rename the plugins folder to something else, like for example: plugins.bak:

If this fixes the error, you know it’s one of the plugins. If not, you’ll need to check the theme.

The best way to switch themes is to repeat this process but instead of renaming the entire plugins folder, you need to rename each individual theme folder, leaving only the latest WordPress default theme (like Twenty-twenty Two or something like that).

In almost all cases, by now, you should have access to your website again, but there’s always other options.

Option 3. Verify the .htaccess file

The .htaccess file contains a number of rules that tell the server what to do in certain circumstances. It is commonly used for rewriting URLs or preventing access to your site for malicious intent. Use your FTP client and check if the file looks suspicious. It typically looks like this if you don’t have a caching plugin installed:

# BEGIN WordPress

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]

# END WordPress

Option 4. Increase your memory

While this is not directly related to this issue, sometimes a lack of PHP memory causes all sorts of weird bugs, so why not try it just to be safe. If you still can’t get to your website, try adding this line in the .wp-config file, just above the line that says: /* That’s all, stop editing! Happy publishing. */:

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

Option 5. If all else fails, ask your hosting company to help

There’s not much else on your end that can be done at this point, so the only thing left to try is to contact your hosting provider to see if it really is their server, or an error on their end, and hope for the best!