If I add a .htaccess file, then the site crashes, the browser displays:

Internal Server Error

I was unable to complete your request.

It can be caused by the error.

May be available in the server error log.

  • 2
    I think it’s necessary to provide the content of .htaccess, otherwise nothing is clear. - ReinRaus
  • I have another question drawn. And why "add the file. Htaccess" , if I do not understand why he and what he does? - Deonis
  • code in the studio! - Artem
  • the code of which, the .htaccess file is empty, but because of it the site does not want to run, here is such a "phenomenon". - Smash
  • one
    "May be available in the server error log ." - Roman Grinyov

5 answers 5

In the configs of the domain from Apache, the following should be allowed:

AllowOverride ALL 

Bring this config file here. I had the same problem on VDS, I decided to just this line.

  • prescribed everywhere in the config AllowOverride ALL, little sense. - Smash
  • BUT! Everything worked out! - Smash

most likely mod_rewrite in the configs is commented out

  • 3
    Not sure, but it seems any error in .htaccess will result in error 500. - ReinRaus
  • The .htaccess file is generally empty. Yes, LoadModule rewrite_module modules / mod_rewrite.so was commented out, but nothing was changed after uncommenting. - Smash
  • And you also helped! - Smash

If the .htaccess file is empty, then delete it nafig, if it is really for some reason you need to register these necessary lines into it, otherwise the error will remain.

Well, or write to him

 RewriteEngine on RewriteBase / 

In general, you can throw off the Apache log file, and there it will be much clearer because of what the error crashes. Without logs nothing is clear. It is quite possible that .htaccess is not empty, that there is some string in it, or it is saved in UTF-8 bom. that will most likely give an error. Options I can write a car and a cart, but the point? The file code is here, the Apache log is also here :)

But still possible in the Apache config is turned off.

  • I wrote that everything is OK! - Smash

It is necessary to remove the # character at the beginning of line 156 in apache\conf\httpd.conf . And write AllowOverride All on lines 229, 265, 378 (line numbers may vary).

  • Would you add how to identify the lines that need to be uncommented - Bald

When the software product has the ability to view the error log, then when an error occurs, you should:

  1. Translate the text of the error in the log and execute what is requested, if it is not difficult;
  2. And / or immediately enter into the search engine a piece of text errors in the log and see how others solved the problem;
  3. If options 1 and 2 did not help, asking a question, give him the text of the error in the log.

Specifically for Apache - more precisely, I have a WampServer , which includes Apache - I have always been helped by method 1 several times. The description of the errors in the log is quite detailed and understandable.

Without the contents of the log, it is impossible to say exactly what the problem is, 500 Internal Server Error can be issued for several reasons. Judging by the results that I got when I googled in search of a solution to a similar problem, most users are helped by replacing #LoadModule rewrite_module modules/mod_rewrite.so strings in #LoadModule rewrite_module modules/mod_rewrite.so in httpd.conf file.

Personally, the removal of all comments in .htaccess helped me, solved the problem by sorting out the log.