php - Apache Regexp 500 Internal Error


I want to rewrite all incoming URLs like:host/lang-EN/product tohost/index.php?lang=lang-EN/product I want to do this for all URLs not changing anything what's after thehost/lang-EN/ just forward it tohost/index.php?lang=lang-EN/whatever was after lang-EN/

This is what I've tried:

RewriteEngine On

RewriteRule     ^(.*)$               index.php/$1   [NC,L]
RewriteRule     ^index.php/(.*)/?$   index.php?lang=$1  [NC,L]

Resulting in Internal Error threw by Apache(last version). I am using Codeigniter as framework.


[Sat Apr 05 12:59:32.044771 2014] [core:error] [pid 3600:tid 1680] [client ::1:3253] `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.`



Try with only this one to redirect/host/... to/host/index.php...

RewriteRule     ^/?(?!index\.php)(.*)$         index.php?lang=$1   [NC,L]

(?!index.php) is negative lookahead to check that there is noindex.php at the beginning. So that it doesn't touch the urls like/index.php?lang=... to avoid recursively.

People are also looking for solutions to the problem: php - unable to convert to innodb from myisam


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.