Knowledge base

1000 FAQs, 500 tutorials and instructional videos. Here, there are only solutions!

Fix a 500 "Internal Server Error"

This guide is for you if you encounter a 500 error that can have various causes generally related to the development of your website on a Web Hosting, particularly with the rewrites of your .htaccess files.

 

Preamble

  • Apache2, in place on the servers, no longer supports certain modules such as mod_auth_anon, mod_auth_dbm, mod_authz_dbm, mod_cern_meta, mod_imap, mod_imagemap, mod_mime_magic
  • Apache2 is strict about syntax errors and when it encounters syntax errors in a .htaccess file, this can result in 500 Internal Server Errors or unexpected URL rewrite errors

 

Syntax examples and correction

In this first example, the syntax error is that the rewrite rule does not specify the HTTP redirection response code to return.

RewriteRule ^articles/([0-9]+)/$ /article.php?id=$1 [L]

The correction adds the R=301 directive to specify that the redirection should return a 301 (permanent) code:

RewriteRule ^articles/([0-9]+)/$ /article.php?id=$1 [L,R=301]

 

In this second example, the syntax error is that the Options directive does not correctly specify the options to enable or disable.

Options -Indexes FollowSymLinks

The correction adds the "+" sign to specify that FollowSymLinks should be enabled rather than disabled:

Options -Indexes +FollowSymLinks

 

Resolving these errors

  • If the first page or another page displays a 500 error, rename the .htaccess file or comment out all lines with # and uncomment line by line until you find the problematic section.
  • If the error occurs after a modification made to one of your pages, the simplest solution is to restore the previous version of the file.

Has this FAQ been helpful?