0
votes

My .htaccess file causes 500 Internal Server Error

    Options -Indexes

    AddDefaultCharset utf-8
    #DefaultLanguage bg
    ServerSignature Off

    <IfModule mod_rewrite.c>
            RewriteEngine on
            RewriteBase /
            RewriteCond %{REQUEST_URI} !webroot
            RewriteRule    ^$    webroot/    [L]
            RewriteRule    (.*) webroot/$1    [L]
    </IfModule>

The mod_rewrite module is on and I think that the line that causes the problem is this one:

RewriteRule    ^$    webroot/    [L]

If I drop the RewriteRule lines from the file it all works but as soon as I add them I get the 500 error. I have just some basic knowledge of .htaccess files so any tips and explanations are more than welcome. Thank you!

EDIT: For reference, here's the .htaccess file in the webroot folder, as requested in the comments:

Options -Indexes
AddDefaultCharset utf-8
#DefaultLanguage bg
ServerSignature Off
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>

I'll try to access the apache log files and see if I can get some guidance from the records there.

ANOTHER EDIT: Here are the apache logged errors:

[Sun Jun 14 14:27:19 2015] [error] [client SOME_IP_ADDRESS] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace., referer: SOME_REFERER [Sun Jun 14 14:27:19 2015] [error] [client SOME_IP_ADDRESS] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace., referer: SOME_REFERER [Sun Jun 14 14:27:19 2015] [error] [client SOME_IP_ADDRESS] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace., referer: MY_DOMAIN_NAME [Sun Jun 14 14:27:19 2015] [error] [client SOME_IP_ADDRESS] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace., referer: MY_DOMAIN_NAME [Sun Jun 14 14:27:20 2015] [error] [client SOME_IP_ADDRESS] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace., referer: SOME_REFERER [Sun Jun 14 14:27:20 2015] [error] [client SOME_IP_ADDRESS] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace., referer: SOME_REFERER [Sun Jun 14 14:27:20 2015] [error] [client SOME_IP_ADDRESS] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace., referer: MY_DOMAIN_NAME [Sun Jun 14 14:27:20 2015] [error] [client SOME_IP_ADDRESS] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace., referer: MY_DOMAIN_NAME

1
It's more than likely the .htaccess file in webroot. Have you made any changes to that one? Please share it with us.Mike Rockétt
I've added the .htaccess file in the webroot as an edit. I'll see if I can get access to the apache error log file on the server as well and see if there's something useful there as well.mmvsbg
Added the apache error logs as well. It seems like on-going redirect but there was a condition in the original file to prevent that. Am I missing something?mmvsbg
Nothing wrong with rules. You will need to enable RewriteLog and show its output here.anubhava

1 Answers

0
votes

You used a RewriteRule Option at the end of the line [L], Make sure there are no leading or trailing space in the braces. i.e

[L ] or [ L]