title: Detect Apache version in apache config?
body: <p><strong>tl;dr:</strong> How do I do the following in a .conf or .htaccess file:</p>
  
  <pre><code>&lt;IfApache22&gt;
    # Do A
  &lt;/IfApache22&gt;
  &lt;IfApache24&gt;
    # Do B
  &lt;/IfApache24&gt;
  </code></pre>
  
  <p><strong>Longer question:</strong></p>
  
  <p>With Apache 2.4 the old <a href="http://httpd.apache.org/docs/2.2/mod/mod_authz_host.html#order" rel="noreferrer">Order</a> get's deprecated in favor of <a href="http://httpd.apache.org/docs/2.4/mod/mod_authz_core.html#require" rel="noreferrer">Require</a>.</p>
  
  <p>In my .htaccess files I have</p>
  
  <pre><code>&lt;FilesMatch "\.(long|list|file|types)$"&gt;
    Order allow,deny
  &lt;/FilesMatch&gt;
  </code></pre>
  
  <p>which means Apache fails to start unless I enable <a href="http://httpd.apache.org/docs/2.4/mod/mod_access_compat.html" rel="noreferrer">access_compat</a>. While doing so presents a useful workaround, I want a solution that works with both syntaxes as the config will be distributed to a lot of servers. The question is how I can detect the current version of Apache and apply the correct directive.</p>
  
  <p>I intend to use the file for a framework that is distributed to and used by a lot of people, and I can't control/guarantee that they have or lack any particular server setup, which is why I'd like the file to be 2.2/2.4 "agnostic".</p>