I am attempting to implement language switching inshtaccess, and also the only factor left now's to deal with clients which don't support snacks. To achieve that, I have to set [cde] once the user clicks a hyperlink having a prefer-language parameter.


The issue is using the last line - The worthiness is definitely set to empty. It really works basically hardcode it, although not basically try to consult a flexible. Can there be some kind of special syntax to consult atmosphere variables within this context, or perhaps is there another method to set RewriteEngine On RewriteBase / RewriteCond %{QUERY_STRING} (?:^|&)language=(en|fr|no) RewriteRule ^(.*)$ $1? [cookie=language:%1:.example.com,env=language:%1,R] SetEnv prefer-language $language ?

Edit: Mix-published to Apache users list.

You are able to set atmosphere variables with mod_rewrite too. Really, you already did that (see [cde]/[cde] flag).

I can’t test drive it with mod_settlement myself, however the following should work and hang the prefer-language:


But it might be far simpler should you place the language identifier in to the URL path like E:


I have no idea if you want the extraOr2nd RewriteCond %{QUERY_STRING} ^((?:[^&]&)*)language=(en|fr|no)&?([^&].*)?$ RewriteRule ^ %{REQUEST_URI}?%1%3 [L,CO=language:%2,R] RewriteCond %{HTTP_COOKIE} (^|[,\s])language=([^\s,;]+) RewriteRule ^ - [L,E=prefer-language:%2] SetEnvIf REDIRECT_prefer-language (.+) prefer-language=$1 variable.

Appears like there is no support for variables in SetEnv, but here is a working configuration if another person is attempting to complete exactly the same. It is a simpler type of language selection, because it just copies the /en/… parameter in the referer to the present URL when not transformed:

SetEnvIf Request_URI ^/(en|fr|no)/ prefer-language=$1
SetEnvIf REDIRECT_prefer-language (.+) prefer-language=$1