views:

133

answers:

2

Hi.

Could anyone help me here with this rewrite rule please?

From this

http://www.SOMEDOMAIN.com/en/somefolder/

To this

http://www.SOMEDOMAIN.com/frontend/somefolder/?idLang=2

From this

http://www.SOMEDOMAIN.com/es/somefolder/

To this

http://www.SOMEDOMAIN.com/frontend/somefolder/?idLang=3

(...)

And for several other languages...where "pt" when the parameter is "idLang=1", "en" when the parameter is "idLang=2", "es" when the parameter is "idLang=3", "br" when the parameter is "idLang=5" and "pt" when the parameter is empty.

Thanks in advance.

A: 
RewriteRule /en/somefolder/$        /frontend/somefolder/?idLang=2 [L]
RewriteRule /es/somefolder/$        /frontend/somefolder/?idLang=3 [L]
RewriteRule /somefolder/$          /frontend/somefolder/?idLang=1 [L]

Hope this helps

Aykut
A: 

Try something like this:

RewriteRule ^pt/(.*) frontend/$1?idLang=1 [QSA,L]
RewriteRule ^en/(.*) frontend/$1?idLang=2 [QSA,L]
RewriteRule ^es/(.*) frontend/$1?idLang=3 [QSA,L]
RewriteRule ^br/(.*) frontend/$1?idLang=5 [QSA,L]
RewriteRule !^frontend/ frontend%{REQUEST_URI}?idLang=1 [QSA,L]
Gumbo