Are you encountering a common WordPress error on your site?
It is a bit tricky because the error doesn’t give any other information, many beginners find it quite frustrating.
In this article, we will show you how to easily fix the 500 internal server error in WordPress.
The 500 Internal Server Error is a common web server error that can occur with any website, not just WordPress. The “500” in the error message is an HTTP status code, indicating:
“500 Internal Server Error response code indicates that the server encountered an unexpected condition that prevented it from fulfilling the request.”
It may look different if you are using Nginx and Google Chrome.
It will also look different if Google Chrome is unable to find an error page to display:
What Causes the Internal Server Error in WordPress?
The internal server error in WordPress is often caused by a corrupt .htaccess file, poorly coded plugins, or your active WordPress theme.
Other possible causes of the internal server error in WordPress are PHP memory limit or corrupt core WordPress files.
In some conditions, the internal server error may only show up when you are trying to access the WordPress admin area while the rest of the site works fine.
Usually, the error is triggered before WordPress can load and the server cannot get enough information about what stopped it.
Fixing the 500 Internal Server Error in WordPress
Before you begin troubleshooting, make sure that you have a complete WordPress backup of your website on hand.
- Using a WordPress Backup Plugin (If You Have Access to Admin Area): If you have access to the WordPress admin area, you can use a WordPress backup plugin to create a complete backup of your website.We recommend using Duplicator for this purpose. Duplicator not only helps you quickly back up your website, but it also allows you to store your backups on the cloud. Most importantly, you can easily restore your website from a backup if needed.
- Manually Creating a WordPress Backup (If You Don’t Have Access to Admin Area): If you don’t have access to the WordPress admin area, you can manually create a WordPress backup using phpMyAdmin and an FTP client.Here are the steps to manually create a backup:
- Using phpMyAdmin: Export your WordPress database.
- Using FTP: Download all your WordPress files (themes, plugins, uploads, etc.).
After ensuring you have a complete backup, you can proceed with troubleshooting and fixing the internal server error on your website.
Clear WordPress and Browser Cache
Browsers and your WordPress caching plugins can sometimes mistakenly store a cached copy of an error page.
- Clear Your Browser Cache: The easiest way to fix this is by first clearing your browser cache. Here’s how you can do it:
- Chrome: Go to Chrome Settings > Privacy and Security > Clear Browsing Data.
- Firefox: Go to Firefox Menu > Options > Privacy & Security > Cookies and Site Data > Clear Data.
- Safari: Go to Safari Menu > Preferences > Privacy > Manage Website Data > Remove All.
- Edge: Go to Edge Menu > Settings > Privacy, Search, and Services > Choose what to clear > Clear now.
- Opera: Go to Opera Menu > Settings > Advanced > Privacy & Security > Clear browsing data.
- Clear WordPress Cache (If You Have Admin Access): If you have access to the WordPress admin area of your website, you can empty the WordPress cache by visiting your caching plugin’s settings page. Here’s how:
- Navigate to your caching plugin’s settings page.
- Find an option to clear the cache and click on it.
- Confirm the action if prompted.
Checking for Corrupt .htaccess File
The.htaccess
file is a server configuration file used by WordPress to set up redirects and other server settings. A common cause of the internal server error is a corrupt.htaccess
file.
Update Permalinks to Regenerate .htaccess File: The easiest way to fix this issue is by visiting the Settings » Permalinks page in the WordPress admin area and clicking on the ‘Save Changes’ button without making any changes:
- Navigate to Settings » Permalinks in your WordPress admin dashboard.
- Scroll down and click on the ‘Save Changes’ button without modifying anything.
- WordPress will attempt to update your
.htaccess
file or generate a new one for you.
You can now visit your website to see if this has resolved the internal server error.
Manually Replace the .htaccess File:If the error persists, you may need to manually replace the .htaccess
file:
- Log in to your website using FTP or the File Manager app in your hosting control panel.
- Locate your
.htaccess
file in the root directory where you find folders likewp-content
,wp-admin
, andwp-includes
. - Right-click on the
.htaccess
file and rename it to something like.htaccess_old
to keep it as a backup.
- Right-click in your site’s root folder and select the ‘Create new file’ option.
- Name this new file
.htaccess
and click ‘OK’ to save it.
- Right-click on the new
.htaccess
file and select ‘View/Edit’. - Paste the following default WordPress rewrite rules into the file:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Increasing the PHP Memory Limit
Sometimes, the internal server error can occur if a script consumes all of the PHP memory limit.
Edit wp-config.php
File:The easiest way to increase the PHP memory limit is by editing the wp-config.php
file. Follow these instructions carefully to avoid breaking your site:
- Connect to your WordPress website using an FTP client or the File Manager app in your hosting control panel.
- Locate the
wp-config.php
file in the main folder of your website. Right-click on it and select ‘Download’ to create a backup. - Right-click on the
wp-config.php
file and select ‘View/Edit’ to open it.
- Add the following code just above the line that reads, ‘That’s all, stop editing! Happy publishing’:
define( 'WP_MEMORY_LIMIT', '256M' );
Note: If 256M
doesn’t solve the problem, you can increase it to 512M
.
- Save your changes.
If Internal Server Error Occurs in wp-admin: If you encounter the internal server error only when trying to log in to your WordPress admin or when uploading an image in wp-admin
, follow these steps:
- Create a blank text file on your computer and name it
php.ini
. - Paste the following code into the file:
memory=256MB
- Save the file.
- Upload it to the /wp-admin/ folder on your server using FTP.
Visit your website to check if increasing the memory limit has resolved the internal server error. Keep in mind that increasing the memory limit only fixes the issue temporarily. You still need to find and address the cause that is exhausting your memory limit, which could be a poorly coded plugin or theme function.
Seek Help from a Professional
If you need further assistance with troubleshooting or fixing your WordPress website, or if you’re looking for paid services, please feel free to contact me on Upwork or LinkedIn.