]> granicus.if.org Git - apache/blob - docs/manual/mod/mod_version.xml
switch to the new format for outdated revision references
[apache] / docs / manual / mod / mod_version.xml
1 <?xml version="1.0"?>
2 <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
3 <?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
4 <!-- $LastChangedRevision$ -->
5
6 <!--
7  Copyright 2004 The Apache Software Foundation
8
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
12
13      http://www.apache.org/licenses/LICENSE-2.0
14
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.
20 -->
21
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>
29
30 <summary>
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>
37
38     <example><title>Examples</title>
39       &lt;IfVersion 2.1.0&gt;<br />
40       <indent>
41         # current httpd version is exactly 2.1.0<br />
42       </indent>
43       &lt;/IfVersion&gt;<br />
44       <br />
45       &lt;IfVersion >= 2.2&gt;<br />
46       <indent>
47         # use really new features :-)<br />
48       </indent>
49       &lt;/IfVersion&gt;
50     </example>
51
52     <p>See below for further possibilities.</p>
53 </summary>
54
55 <directivesynopsis type="section">
56 <name>IfVersion</name>
57 <description>contains version dependent configuration</description>
58 <syntax>&lt;IfVersion [[!]<var>operator</var>] <var>version</var>&gt; ...
59 &lt;/IfVersion&gt;</syntax>
60 <contextlist><context>server config</context><context>virtual host</context>
61 <context>directory</context><context>.htaccess</context></contextlist>
62 <override>All</override>
63
64 <usage>
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
74     possible:</p>
75
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>&gt;</code></td>
81         <td>httpd version is greater than</td></tr>
82     <tr><td><code>&gt;=</code></td>
83         <td>httpd version is greater or equal</td></tr>
84     <tr><td><code>&lt;</code></td>
85         <td>httpd version is less than</td></tr>
86     <tr><td><code>&lt;=</code></td>
87         <td>httpd version is less or equal</td></tr>
88     </table>
89
90     <example><title>Example</title>
91       &lt;IfVersion >= 2.1&gt;<br />
92       <indent>
93         # this happens only in versions greater or<br />
94         # equal 2.1.0.<br />
95       </indent>
96       &lt;/IfVersion&gt;
97     </example>
98
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>
101
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>
110     </table>
111
112     <example><title>Example</title>
113       &lt;IfVersion = /^2.1.[01234]$/&gt;<br />
114       <indent>
115         # e.g. workaround for buggy versions
116       </indent>
117       &lt;/IfVersion&gt;
118     </example>
119
120     <p>In order to reverse the meaning, all operators can be preceded by an
121     exclamation mark (<code>!</code>):</p>
122
123     <example>
124       &lt;IfVersion !~ ^2.1.[01234]$&gt;<br />
125       <indent>
126         # not for those versions<br />
127       </indent>
128       &lt;/IfVersion&gt;
129     </example>
130
131     <p>If the <var>operator</var> is omitted, it is assumed to be
132     <code>=</code>.</p>
133 </usage>
134 </directivesynopsis>
135
136 </modulesynopsis>