Internal server error WordPress

If you get the error message “Internal Server error” on your website you probably have some component on it that is interfering with the upload of the web server.

How does the error occur?

A common reason for this error to occur is because the page has been moved from our old platform with Apache 2.2 to the new platform with Apache 2.4.
This is a necessary move when Apache 2.2 reaches End of Life which it did in the summer of 2017.

What causes the error and how do you solve it?

The most common reason is that you have some rows in your .htaccess file that is incompatible with Apache 2.4. The reason is usually that you have a plugin such as “All in One WP Security” and “Firewall” or “W3 Total Cache” that has added rows to the .htaccess file for various reasons (f.ex to secure or speed up the page).

The quickest way to solve this issue is by logging in to your FTP and to edit the .htaccess file.

Either you delete all the lines in the file besides these:

  1. # BEGIN WordPress
  2. <IfModule mod_rewrite.c>
  3. RewriteEngine On
  4. RewriteBase /
  5. RewriteRule ^index\.php$ – [L]
  6. RewriteCond %{REQUEST_FILENAME} !-f
  7. RewriteCond %{REQUEST_FILENAME} !-d
  8. RewriteRule . /index.php [L]
  9. </IfModule>
  10. # END WordPress

Save it and upload the file again.

Advanced suggestions for solutions:

If you want to keep the other rows in .htaccess but still solve this issue we have some tips:

The “All in One WP-Security” and “Firewall” plugin has a built-in firewall called 5G and/or 6G Firewall.
This adds rows to .htaccess which unfortunately is not supported by Apache 2.4.

Then changes has to be made for the following:

  1. # SetEnvIfNoCase User-Agent ^$ keep_out
  2. SetEnvIfNoCase User-Agent (binlar|casper|cmsworldmap|comodo|diavol|dotbot|feedfinder|flicky|ia_archiver|jakarta|kmccrew|nutch|planetwork|purebot|pycurl|skygrid|sucker|turnit|vikspider|zmeu) keep_out
  3. Require all granted
  4. Require not env keep_out
  5. Order Allow,Deny
  6. Allow from all
  7. Deny from env=keep_out

Those need to be changed to:

  1. # 5G:[USER AGENTS]
  2. SetEnvIfNoCase User-Agent ([a-z0-9]{2000,}) bad_bot
  3. SetEnvIfNoCase User-Agent (archive.org|binlar|casper|checkpriv|choppy|clshttp|cmsworld|diavol|dotbot|extract|feedfinder|flicky|g00g1e|harvest|heritrix|httrack|kmccrew|loader|miner|nikto|nutch|planetwork|postrank|purebot|pycurl|python|seekerspider|siclab|skygrid|sqlmap|sucker|turnit|vikspider|winhttp|xxxyy|youda|zmeu|zune) bad_bot
  4. # Apache < 2.3
  5. Order Allow,Deny
  6. Allow from all
  7. Deny from env=bad_bot
  8. # Apache >= 2.3
  9. Require all Granted
  10. Require not env bad_bot

Save and upload the file.

If your website has “W3 Total Cache“:

Open your .htaccess file as above and delete all rows added by W3.
If the page can be logged in to again log in to the admin panel and uninstall W3. Then reinstall it and re-enable the settings you want.
The plugin will now recognize your server version and insert correct rows in your .htaccess.

If your page has “WP Fastest Cache” and gets this error:

Probably it is because you have activated “Gzip“. See this guide for solution.

Was this article helpful?

Related Articles