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