title: Apache VirtualHost conditional based on an environment variable
body: <p>I'm trying to include a config file inside an Apache 2.4 <code>&lt;VirtualHost&gt;</code> based on the presence of an environment variable.</p>
  
  <p>Inside the <code>VirtualHost</code> declaration, I set the <code>VIEWMODE</code> environment variable as such:</p>
  
  <pre><code>Define virtualhost_config "${virtualhost_path}/conf/virtualhost.conf"
  &lt;VirtualHost *:80&gt;
          SetEnv VIEWMODE demo
          Include "${virtualhost_config}"
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>Inside the included config file, I now have this conditional inside the <code>&lt;Directory&gt;</code> block:</p>
  
  <pre><code>&lt;If "env('VIEWMODE') == 'demo'"&gt;
      RewriteRule (.*) http://www.apple.com/ [L,R=302]
  &lt;/If&gt;
  </code></pre>
  
  <p>However, I can't seem to get this to work. The conditional <code>RewriteRule</code> is ignored.</p>
  
  <p>What am I missing?</p>