2 <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
3 <?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
4 <!-- $LastChangedRevision$ -->
7 Copyright 2004 The Apache Software Foundation
9 Licensed under the Apache License, Version 2.0 (the "License");
10 you may not use this file except in compliance with the License.
11 You may obtain a copy of the License at
13 http://www.apache.org/licenses/LICENSE-2.0
15 Unless required by applicable law or agreed to in writing, software
16 distributed under the License is distributed on an "AS IS" BASIS,
17 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 See the License for the specific language governing permissions and
19 limitations under the License.
22 <modulesynopsis metafile="mod_version.xml.meta">
23 <name>mod_version</name>
24 <description>Version dependent configuration</description>
25 <status>Extension</status>
26 <sourcefile>mod_version.c</sourcefile>
27 <identifier>version_module</identifier>
28 <compatibility>Available in version 2.1 and later</compatibility>
31 <p>This module is designed for the use in test suites and large
32 networks which have to deal with different httpd versions and
33 different configurations. It provides a new container -- <directive
34 type="section" module="mod_version">IfVersion</directive>, which
35 allows a flexible version checking including numeric comparisons and
36 regular expressions.</p>
38 <example><title>Examples</title>
39 <IfVersion 2.1.0><br />
41 # current httpd version is exactly 2.1.0<br />
43 </IfVersion><br />
45 <IfVersion >= 2.2><br />
47 # use really new features :-)<br />
52 <p>See below for further possibilities.</p>
55 <directivesynopsis type="section">
56 <name>IfVersion</name>
57 <description>contains version dependent configuration</description>
58 <syntax><IfVersion [[!]<var>operator</var>] <var>version</var>> ...
59 </IfVersion></syntax>
60 <contextlist><context>server config</context><context>virtual host</context>
61 <context>directory</context><context>.htaccess</context></contextlist>
62 <override>All</override>
65 <p>The <directive type="section">IfVersion</directive> section encloses
66 configuration directives which are executed only if the
67 <program>httpd</program> version
68 matches the desired criteria. For normal (numeric) comparisons the
69 <var>version</var> argument has the format
70 <code><var>major</var>[.<var>minor</var>[.<var>patch</var>]]</code>, e.g.
71 <code>2.1.0</code> or <code>2.2</code>. <var>minor</var> and
72 <var>patch</var> are optional. If these numbers are omitted, they are
73 assumed to be zero. The following numerical <var>operator</var>s are
76 <table style="zebra" border="1">
77 <tr><th><var>operator</var></th><th>description</th></tr>
78 <tr><td><code>=</code> or <code>==</code></td>
79 <td>httpd version is equal</td></tr>
80 <tr><td><code>></code></td>
81 <td>httpd version is greater than</td></tr>
82 <tr><td><code>>=</code></td>
83 <td>httpd version is greater or equal</td></tr>
84 <tr><td><code><</code></td>
85 <td>httpd version is less than</td></tr>
86 <tr><td><code><=</code></td>
87 <td>httpd version is less or equal</td></tr>
90 <example><title>Example</title>
91 <IfVersion >= 2.1><br />
93 # this happens only in versions greater or<br />
99 <p>Besides the numerical comparison it is possible to match a regular
100 expression against the httpd version. There are two ways to write it:</p>
102 <table style="zebra" border="1">
103 <tr><th><var>operator</var></th><th>description</th></tr>
104 <tr><td><code>=</code> or <code>==</code></td>
105 <td><var>version</var> has the form
106 <code>/<var>regex</var>/</code></td></tr>
107 <tr><td><code>~</code></td>
108 <td><var>version</var> has the form
109 <code><var>regex</var></code></td></tr>
112 <example><title>Example</title>
113 <IfVersion = /^2.1.[01234]$/><br />
115 # e.g. workaround for buggy versions
120 <p>In order to reverse the meaning, all operators can be preceded by an
121 exclamation mark (<code>!</code>):</p>
124 <IfVersion !~ ^2.1.[01234]$><br />
126 # not for those versions<br />
131 <p>If the <var>operator</var> is omitted, it is assumed to be