The most common cause for a 500 Internal Server Error.

Have you ever come across this message –

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at admin@example.com to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.


Apache/2.4.9 (Win64) PHP/5.5.12 Server at localhost Port 80″

Cause:

For me, the number one reason I end up getting this error is: Some bad code in the .htaccess file or some rewrite rules entered by a security plug-in.

505-internal-server-error-4

It has happened in my development environment and in live sites.

The first thing to do is to look for your .htaccess file. Sometimes there may be more than one. They are going to be found in the root of the site or a directory above, depending on your setup.

On your host, the root folder will be where you will find your WordPress core files like your wp-config.php file and your wp-content folder. If you have your site in a sub-folder, you may also have an .htaccess file on your site’s parent folder.

Solution:

Try re-naming or moving the .htaccess file in the root folder of your site and testing. If that does not help, check the parent folder for an .htaccess file, if you find one there try to rename or move the file and see if your site comes back. I would advise not to delete the file(s) in case it contains code you need to keep.

If you rename or move the .htaccess file and the error persists, then the error is being caused by something else. Take a look at this post for some other reasons you may get this error. One rare possibility is having folder permissions above 755 which I found in one of SiteGround’s KB articles.

If you are using WAMP,  you will want to check the c:\wamp\www folder for the .htaccess file. If you find one, move or re-name it and see if this takes care of the error. Just like on your host, if you have your site in a sub-folder (c:\wamp\www\mysite) then check for the .htaccess file there.

505-internal-server-error-3

If you happened to be using a security plug-in and after making adjustments you encounter a 500 internal server error, then most likely your plug-in made some edits to your .htaccess file that has caused the error. Try opening the .htaccess file in a text editor and see if you can identify the re-write rules entered by the plug-in and delete them.

Here is an example of an edit I did recently that caused the 500 internal server error.

After enabling the’Trace and Track’ and ‘Proxy Comment Posting’ feature in the WP Security plug-in, my site was unreachable and displayed a 500 internal server error.

the-most-common-cause-for-a-500-internal-server-security

I immediately opened the .htaccess file on the root and found the entries the plug-in had made. You can see where each entry start and end thanks to the comments.

the-most-common-cause-for-a-500-internal-server-rewrites

After deleting the entries and saving the file the site was back to normal. If you are not sure you are deleting the right code then I would recommend you just rename or move the file.

If your site is back online after you have re-named or moved the .htaccess file , make sure you go to your Permalinks settings and re-save them. This will re-create a new .htaccess file with correct rewrite rules. If you do not do this you may encounter errors viewing your sites Blog pages.

If you just edited the .htaccess file then you don’t need to do the above step.

I hope this helps. If you have found yourself with this error and was caused by something other than the .htaccess file, please let me know in the comments below. I would love to know of other causes and the fix for them.

If you have any questions please feel free to get in touch or write a comment on the section below. Thanks for stopping by.

4 Comments on “The most common cause for a 500 Internal Server Error.

  1. Hi,
    I looking for some assistance in apache to generate 500 response code.

    In my project there is 60 rules, I need to disable group of rules and send back response code as 500.

    Thanks & Regards,
    Sendhil

    1. There are many ways to get this error .. you can probably replicate it by writing some of the rewrite rules shown in my example which were entered by the WPSecurity plugin. Here is a way to triger it via php, check out http://hsny.co/1IyslXd. Hope this helps.

  2. when i configure the wordpress project in local i got this error.

    [Thu Sep 10 14:48:53.352591 2015] [core:alert] [pid 3912:tid 1516] [client 127.0.0.1:51795] C:/wamp/www/mappingtheleft/.htaccess: Invalid command ‘Header’, perhaps misspelled or defined by a module not included in the server configuration, referer: http://localhost/

    1. Hi viru, I have not seen this error before. Is this when you visit localhost? Have you tried re-installing or deleting any htaccess files in the root?

Leave a Reply to Henry Cancel reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.