Hi everybody,
I am going crazy with trying something that is probably really simple I just can't figure out where my syntax is wrong. Sitation:
I want urls to look like this:
www . mypage . com/en/topic1/subtopic10.html
which is supposed to translate into
/index.php?path=$1&lang=1
This is working fine. I have set this up for three languages: en, fr, and de using rules like this:
RewriteRule ^en/(.*).html /index.php?path=$1&lang=1
However, since we are just implementing multi-language options on the site our old links looked like this:
www . mypage . com/topic1/subtopic10.html -> without the language flag. I want the old links to translate automatically into the default language, meaning if someone enters
www . mypage . com/topic1/subtopic10.html it automatically assumes: /index.php?path=$1&lang=1
So the .htaccess has to check if a language flag exists in the url before executing a Rewrite Rule, right? I thought it would look something like this:
RewriteCond %{REQUEST_URI} ^en/.*\.html [NC]
RewriteRule ^en/(.*).html /index.php?path=$1&lang=1 [L]
Basically what I want is this:
IF URL contains (right at the beginning) /en/ -> then RewriteRule ^en/(.*).html /index.php?path=$1&lang=1
IF URL contains (right at the beginning) /de/ -> then RewriteRule ^de/(.*).html /index.php?path=$1&lang=2
IF URL contains (right at the beginning) /fr/ ->RewriteRule ^fr/(.*).html /index.php?path=$1&lang=3
ELSE RewriteRule RewriteRule ^(.*).html /index.php?path=$1&lang=1
How far away from the solution am I? Can someone help?
Kind regards,
Napper