I am facing a problem 500 server error, I try to redirect the user to a different URL depending on his country of origin using the .htaccess file and GEOIP, I use Codeigniter 3.
Error 500 : Is [Fri Jul 15 15:37:32.432374 2022] [core:error] [pid 3029:tid 140071902476032] [client 86.235.179.208:0] AH00124: 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.
I would like to do this : https://example.com ----> https://example.com/fr/
Here's my script before adding the code :
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
and after adding the code :
RewriteEngine On
RewriteCond %{HTTP:X-FORWARDED-COUNTRY} ^France$
RewriteRule ^([^/]+)$ /fr/ [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
Thanks in advance for your help.
/fr/salut, that is then rewritten to/index.php?/fr/salut, which is again rewritten to/fr/index.php, what results in/index.php?/fr/index.php, which ...