.htaccess & 500 Internal Server Error

The 500 Internal Server Error may show if .htaccess contains syntax errors.

The 500 Internal Server Error may appear under the following error messages:

  • 500 - Internal server error. There is a problem with the resource you are looking for, and it cannot be displayed.
  • Internal Server Error. The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server log.
  • 500 Internal Server Error. Oops, something went wrong. Try to refresh the page or feel free to contact us if the problem persists.

Confirmthat the 500 Internal Server Error is due to an incorrect .htaccess file configuration by removing all textfrom the .htaccess file. Save the changes and reload the page.

Fix 500 Internal Server Error

Enable Mod_Rewrite

The 500 Internal Server Error appears if the Mod_Rewrite Apache module is disabled. You can spot this if the AllowOverride directive is set to None in httpd.conf.

To fix the 500 Internal Server Error, follow these steps:

  1. Enable the Mod_Rewrite module by updating the AllowOverride directive from None to All. This directive is found in the httpd.conf, at the <Directory> section:

     <Directory /var/www/mydomain_com>
         Options Indexes FollowSymLinks MultiViews
         AllowOverride All
         Order allow,deny
         Allow from all
     </Directory>
  2. Update the .htaccess to use the RewriteEngine on directive:

     RewriteEngine on
     RewriteCond %{HTTP_HOST} ^mydomain\.com [NC]
     RewriteRule ^(.*)$ http://www.mydomain.com/$1 [L,R=301,NC]