Caching pages with boost based on a cookie value
Ok, it took me a while, but I solved it. It lead me to learn some interesting details about Apache and Drupal.

In my question above I wondered why the rewrite rules did not alter the QUERY_STRING in Apache because apparently, the correct page was not fetched from the cache. However, the problem was not that the correct page was not fetched, but that the correct page was not written to the cache in the first place.

Looking into the code of Boost showed that it uses Drupal's request_uri() function to determine the name of the cache file. This function in turn uses PHP's $_SERVER['REQUEST_URI'] if set. Some tests in PHP then showed that the rewrite rules do actually change $_SERVER['QUERY_STRING'], but that this change is not reflected in $_SERVER['REQUEST_URI']. In other words, the query parameters in $_SERVER['REQUEST_URI'] are the ones of the original request, not the ones as potentially rewritten by mod_rewrite.

To solve this, you can add some code to (for example) Drupal's settings.php to update $_SERVER['REQUEST_URI'] similarly as done in your .htaccess. This worked for me:

if(isset($_SERVER['REQUEST_URI']) &amp;&amp; isset($_GET['cookie'])) {
  $cookie = $_GET['cookie'];
  if(strpos($_SERVER['REQUEST_URI'],'?') === false) { 
    $_SERVER['REQUEST_URI'] = $_SERVER['REQUEST_URI'] . '?cookie=' . $cookie;
  } else {
    // I'm not sure what happens if &amp;cookie is already set
    $_SERVER['REQUEST_URI'] = $_SERVER['REQUEST_URI'] . '&amp;cookie=' . $cookie;
  }
}


Note 1: $_GET does contain the rewritten request parameters, so I guess this is based on QUERY_STRING.

Note 2: code above only adds my application-specific cookie. I guess a generic solution would be to completely remove the request string of $_SERVER['REQUEST_URI'] and add all elements in $_GET again.

Note 3: you need both the rewrite rules in .htaccess and this code in settings.php. The former are needed to have Boost fetch the correct page from the cache, the latter to have Boost write the correct page in the cache.