有人可以帮我解决这个重写规则吗?
从此
http://www.SOMEDOMAIN.com/en/somefolder/
到此
http://www.SOMEDOMAIN.com/frontend/somefolder/?idLang=2
从此
http://www.SOMEDOMAIN.com/es/somefolder/
到此
http://www.SOMEDOMAIN.com/frontend/somefolder/?idLang=3
(...)
对于其他几种语言......当参数为“idLang = 1”时“pt”,参数为“idLang = 2”时为“en”,参数为“idLang = 3”时为“es” ,参数为“idLang = 5”时为“br”,参数为空时为“pt”。
提前致谢。
答案 0 :(得分:0)
RewriteRule /en/somefolder/$ /frontend/somefolder/?idLang=2 [L]
RewriteRule /es/somefolder/$ /frontend/somefolder/?idLang=3 [L]
RewriteRule /somefolder/$ /frontend/somefolder/?idLang=1 [L]
希望这有帮助
答案 1 :(得分:0)
尝试这样的事情:
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]