Visualise a three step jump sporting event, with the first two steps perfect in place and the third step launching into air, never coming back and eventually a crash! That is what this question boils down to :)
STEP 1:WORKS serve /somepage?ln=xx
when user navigates to /xx/somepage
.
# if user inputs nice urls /xx/somepage to serve page /someapge?ln=xx
RewriteRule ^([a-z][a-z])/(.*) /$2?ln=$1 [L]
STEP 2:WORKS go to the homepage when only language is given /xx/
# if language xx given but no page given? then redirect to its home /xx/home
RewriteRule ^([a-z][a-z])/?$ /$1/home [R=301,L]
STEP 3:CRASH
# if user inputs /somepage then redirect to default english: /en/somepage
# if user inputs /somepage?ln=xx redirect to nice url /xx/somepage
RewriteCond %{REQUEST_URI} !^/../ [NC]
RewriteRule ^(.*)$ /en/$1 [R=301,L]
The third rule is where we are stuck... PS: The redirection should work both for extensionless files somepage?ln=xx as well as files with extension somepage.abc?ln=xx where the extension can be any 2 or 3 char-word, or if easier, checked manually with the following extensions i use [.php .uu .u3c .vls]
Thanks a Thousand!