2.4.3.6. Error 500 Internal Server Error
It is possible to reliably determine the cause of the error 500 by analyzing Errorlog site. Also, in identifying the source of the problem, it can help technical check of the site.
.Htaccess directives
Often error 500 is associated with incorrectly specified directives in the file .htaccess, which is located in directory of your site... You can edit this file using the built-in editor filemanager or any FTPclient.
If the problem was found to be related to the file .htaccess, then you should try making the following changes:
Options +FollowSymLinks
— needs to be replaced withOptions +SymLinksIfOwnerMatch
.Options All -Indexes
- needs to be replaced withOptions -Indexes
.+ExecCGI
- you need to delete.
The hosting does not use the Apache module mod_version
, so if in .htaccess there are blocks with directives IfVersion
they should also be removed, leaving only the contents of the Apache 2.4 blocks.
Comment out directives in the file .htaccess you can put the character at the beginning of the line #
.
Invalid file permissions
Attention!
It is not recommended to set the rights above640
for files and 750
for directories, as this can result in a 500 error.
If in Errorlog there is an error on the site «Script file is writable by others», then you need to restore the standard file permissions by instructions or manually, specifying the rights for the files 640
.
This situation can occur when restoring from a backup or uploading files from a new site.
Using the old syntax of the FilterProvider directive
In most cases, commenting out this directive is sufficient because it is used to enable compression based on Content-Type
, and on our hosting nginx is responsible for compression and most often these requests do not reach Apache.
In Apache 2.2 format, the directive looks like this:
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/html
In Apache 2.4, the same directive looks like this:
FilterProvider COMPRESS DEFLATE "%{CONTENT_TYPE} = 'text/html'"
The situation can be corrected by changing the syntax of the directives from the old to the new one.
Comments at the end of the line
Comments at the end of a line may cause an error «…htaccess: No comments are allowed here».
In newer versions of Apache, the entire line is required to write a comment. That is, when you add the symbol #
to make a comment, it must be the first nonblank character on the line. If you add any nonblank characters before the pound sign, you get a 500 error.
For example, any of these comments are correct:
# this is a comment ## this is another comment ### multiple pound signs are fine
Examples of invalid comments leading to an error:
ExpiresActive on # this will trigger an error RedirectMatch 403 /spamhole/ # this will trigger an error # this will trigger an error
BOMsymbols
V .htaccess when editing by third-party editors, invisible BOM symbols may be written, due to which an error occurs. To fix the problem, open the file in an editor, resave it in pure UTF-8 encoding and upload it back to the hosting.