title: How to use SetEnv with a URL parameter
body: <p>I'm trying to implement language switching in .htaccess, and the only thing left now is to handle clients which don't support cookies. To do that, I must set <a href="http://httpd.apache.org/docs/2.0/env.html" rel="noreferrer"><code>prefer-language</code></a> when the user clicks a link with a <code>language</code> parameter. </p>
  
  <pre><code>RewriteEngine On
  RewriteBase /
  RewriteCond %{QUERY_STRING} (?:^|&amp;)language=(en|fr|no)
  RewriteRule ^(.*)$ $1? [cookie=language:%1:.example.com,env=language:%1,R]
  
  SetEnv prefer-language $language
  </code></pre>
  
  <p>The problem is with the last line - The value is always set to empty. It works if I hardcode it, but not if I try to refer to a variable. Is there some special syntax to refer to environment variables in this context, or is there some other way to set <code>prefer-language</code>?</p>
  
  <p>Edit: Cross-posted to <a href="http://httpd.markmail.org/message/eqiy7lemrtmkgjfl" rel="noreferrer">Apache users list</a>.</p>