A website can suddenly stop working for a variety of reasons and one is error 500. Successful requests for a website usually give a status code of 200. One of the first things that we can do when a website isn’t working is to find out the status code returned by the server. This might not always lead you directly to the root cause of the problem, but it can sometimes help in determining the next series of steps that you can take to get the website up and running again quickly.
In this post, you will learn how to fix a 500 error on your website.
What Is a 500 Error and What Causes It?
A 500 error basically means that the server has come across an unexpected situation that it didn’t know how to handle. As a result, it serves users with either a 500-error page or a completely white screen.
The explanation doesn’t help us much, but there are some common things that can cause this error. Here are some examples:
- a corrupt .htaccessfile
- faulty or incompatible plugins
- limited PHP memory
- corrupted websites core files
Fixing a 500 Error on a WordPress Website
Now, we will briefly go over the steps that you can take to resolve any errors caused by the issues mentioned above. Let’s get started.
A Corrupt .htaccess File
Any misconfiguration of the .htaccess file can potentially cause a 500 error. You should consider reading this getting started guide on .htaccess to learn more about this file if you aren’t already familiar with it.
The easiest way to fix it is to take a backup of the current . htaccess file and then delete it from your server. You can usually find it in the root directory of your Website’s hosting account.
Make sure you download the file first before deleting it. This will allow you to upload it again if you find that the .htaccess file wasn’t causing the error.
Try visiting your website after deleting the .htaccess file. If deleting the file resolves your 500 error, you can generate a fresh .htaccess file by visiting Settings > Permalinks and then clicking on Save Changes. Otherwise, simply upload the old .htaccess file back to your server.
Faulty or Incompatible Plugins
Sometimes the plugins or themes that you have installed can result in a 500 error due to some incompatibility or other faulty code. The best way to resolve any errors caused due to this incompatibility is to simply deactivate all the plugins and then see if you are still getting the 500 error.
If deactivating all the plugins solved the problem for you, then this means that one of the plugins is causing the 500 error. Now, you can start activating each of them one by one to see which of them is at fault. Keep checking the website for a 500 error after activating each plugin.
If activating a plugin shows you a 500 error, you can contact the plugin developers to let them know about this issue so that they can fix it in the next update or suggest a quick fix.
Limited PHP Memory
Although rare, it is possible that you are getting a 500 error because something inside a theme or plugin is exhausting all your allocated memory. One quick fix for this is to simply increase the memory limit.
Open the .htaccess file that you learned about in the first section and place the following lines inside it.
It would be better to place them just before # END Website in order to avoid any unexpected surprises. This should increase the allocated memory. You can check the new values by going to Tools > Site Health > Info > Server inside the Website’s admin dashboard.
Remember that this is just a temporary quick fix. The ideal solution would be to find out what exactly is causing this spike in memory use and then fix that function inside the plugin or theme. Otherwise, you will run out of memory again sooner or later.
Corrupted Website Core Files
It is highly unlikely that corrupted Website core files could be causing a the error on your website. However, this fix is worth a try if none of the above resolved the error for you.
What we are trying to do here is replace the core Website files for two directories called wp-admin and wp-includes. You shouldn’t be making any changes to the contents of files located inside these directories as they are used to keep your Website functional. Changing anything there either intentionally or unintentionally can result in a 500 error.
In this post, I mentioned four different reasons that might cause a 500 error on your website and briefly explained how you can fix each of them. Hopefully, one of these will resolve the 500 error. Consider contacting your web host to get some additional help if none of the steps mentioned here worked for you.
Subscribe for newsletter
* You will receive the latest news and updates on your favorite celebrities!
UX Design and SEO: What’s The Connection
To put it simply, the goal of SEO and UX both is to give users the best experience when they…
Globalizing your UX Designs
Designing for users across the globe creates more inclusive experiences and products. Designing for a global audience while collaborating with…
Gamification in UX Design: Enhancing user experience and engagement
Gamification has emerged as among the most amazing trends in UX design in the last few years. Games play a…