How to fix a random 500 internal server error on your website
Recently, my Uptime monitor notified me of a site I manage being down. I immediately went to check out what was going on and found the site giving off a 500 internal server error.
I hadn’t performed any updates on the site recently and was the only one with access to modify code. My security monitor affirmed there was no recent intrusion, malware or nefarious code on the site. Nothing I could point to that could have been the cause of this error.
The culprit? A corrupted .htaccess file.
How .htaccess files can lead to 500 internal server errors
The .htaccess file is an essential WordPress file that controls how your server functions and runs. Sometimes this file can inadvertently get corrupted by plug-in, host or server inputs.
To check if the .htaccess file is the culprit, simply:
- Access the server via SFTP
- Find the .htaccess file in the root directory
- Rename the file to something like “.htaccess.old” and then save (with no .htaccess file visible, the server will automatically regenerate a new file)
- Wait a few short minutes for the server to regenerate the new .htaccess file
- Once regenerated, check your site’s homepage and see if the 500 internal server error is gone.
- If it is, log-in to your WP-Dashboard and reset your permalinks (Dashboard -> Settings -> Permalinks -> DON’T CHANGE ANYTHING, just Click “save changes”)
- Go back out and check the rest of your site to make sure everything is appearing properly
This simple fix, helped me quickly get my client’s site back up and running without hardly anyone noticing the downtime.
If only all fixes were so simple 😉