Thank you, Mike.
"[L]" means "last rule", so if this set
of Condition and Rule apply,
nothing below this will be executed: if language
"de" is given, the
first Rule will be executed and nothing else; if no
"de" we search for
"en"; if "en", we execute the second
Rule and then stop; if no "en" the
last Rule will be executed - it has no Condition and will be
executed
under all circumstances (exept when one of the other Rules
gets
executed and "[L]" makes the script stop.
[L] is like exit(); in PHP.
RewriteCond is like if() in PHP.
No Cond is like else {} in PHP.
So all of the above means (sort of):
if (deutsch) deliver deutsch then stop; elseif (english)
deliver
english then stop; else deliver (norwegian);
If I put the last, the ".../no/"-Rule first, only
this one will be
executed.
By the way, I have found a solution that works. I needed
to ask for
the HTTP-header, because RewriteCond does not accept
HTTP_ACCEPT_LANGUAGE. This works:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP:Accept-Language} ^.*de.*$ [NC]
RewriteRule ^(index.php)?$ http://www.domain.com/de/
a> [L,R=301]
RewriteCond %{HTTP:Accept-Language} ^.*en.*$ [NC]
RewriteRule ^(index.php)?$ http://www.domain.com/en/
a> [L,R=301]
RewriteRule ^(index.php)?$ http://www.domain.com/no/
a> [L,R=301]
|