500 Internal Server Error is tricky. They never tell you the reason. Just like that one friend who suddenly avoiding you.
No matter what it is, the cause has to be recent. So think back of what you just changed or installed.
If you are not sure, here are two common causes of Internal Server error:
1. Faulty htaccess File
HTAcess is a server configuration file. Some plugin like W3 Total Cache automatically edits this upon activation and may cause error.
This is the first thing you should check. Launch your FTP like Filezilla and you can find the file in the root directory of your project:
Try reverting your.htaccess
to the default config listed below. If it’s fixed, then you can proceed to figure out what’s wrong with the previous config.
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule . index.php [L]
2. Out of Memory
A typical WordPress site rarely ran out of memory, so if one does, it needs serious optimization. Of course you can simply increase the limit by adding this code in WP Config, but we don’t recommend it:
...
define( 'WP_MEMORY_LIMIT', '256M' );
...
Here are 4 methods to optimize your site ordered from highest to lowest priority:
- Use Cache plugin
Cache is a temporary copy of your site. So instead of loading from database when someone visits, it serves this copy. The plugin I like the most is W3 Total Cache. - Compress Images
Use image optimizer plugin like EWWW. The file size will become lower at the cost of slight quality, but mostly unnoticeable. - Connect to Cloudflare
It’s a 3rd party service to help secure and speed up your site, which mean it reduces the stress from your server. - (Last resort) Migrate to a better hosting
Check the specs of your current hosting. I used a plan in Webfaction with 512 MB Memory and it can easily handle 10+ sites.
Conclusion
In my experience, the only cause of Internal Server Error is either faulty.htaccess
or lack of memory.
Corrupted theme, plugins, or WordPress core can only trigger a standard Fatal Error that shows you what the error is and in which file.
Feel free to share your experience with Internal Server Error in the comment below 🙂