]> granicus.if.org Git - apache/blob - docs/manual/mod/mod_version.xml
a few new translations and up-to-date patches
[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 <!-- $Revision: 1.3 $ -->
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 httpd version
67     matches the desired criteria. For normal (numeric) comparisons the
68     <var>version</var> argument has the format
69     <code><var>major</var>[.<var>minor</var>[.<var>patch</var>]]</code>, e.g.
70     <code>2.1.0</code> or <code>2.2</code>. <var>minor</var> and
71     <var>patch</var> are optional. If these numbers are omitted, they are
72     assumed to be zero. The following numerical <var>operator</var>s are
73     possible:</p>
74
75     <table style="zebra" border="1">
76     <tr><th><var>operator</var></th><th>description</th></tr>
77     <tr><td><code>=</code> or <code>==</code></td>
78         <td>httpd version is equal</td></tr>
79     <tr><td><code>&gt;</code></td>
80         <td>httpd version is greater than</td></tr>
81     <tr><td><code>&gt;=</code></td>
82         <td>httpd version is greater or equal</td></tr>
83     <tr><td><code>&lt;</code></td>
84         <td>httpd version is less than</td></tr>
85     <tr><td><code>&lt;=</code></td>
86         <td>httpd version is less or equal</td></tr>
87     </table>
88
89     <example><title>Example</title>
90       &lt;IfVersion >= 2.1&gt;<br />
91       <indent>
92         # this happens only in versions greater or<br />
93         # equal 2.1.0.<br />
94       </indent>
95       &lt;/IfVersion&gt;
96     </example>
97
98     <p>Besides the numerical comparison it is possible to match a regular
99     expression against the httpd version. There are two ways to write it:</p>
100
101     <table style="zebra" border="1">
102     <tr><th><var>operator</var></th><th>description</th></tr>
103     <tr><td><code>=</code> or <code>==</code></td>
104         <td><var>version</var> has the form
105             <code>/<var>regex</var>/</code></td></tr>
106     <tr><td><code>~</code></td>
107         <td><var>version</var> has the form
108             <code><var>regex</var></code></td></tr>
109     </table>
110
111     <example><title>Example</title>
112       &lt;IfVersion = /^2.1.[01234]$/&gt;<br />
113       <indent>
114         # e.g. workaround for buggy versions
115       </indent>
116       &lt;/IfVersion&gt;
117     </example>
118
119     <p>In order to reverse the meaning, all operators can be preceded by an
120     exclamation mark (<code>!</code>):</p>
121
122     <example>
123       &lt;IfVersion !~ ^2.1.[01234]$&gt;<br />
124       <indent>
125         # not for those versions<br />
126       </indent>
127       &lt;/IfVersion&gt;
128     </example>
129
130     <p>If the <var>operator</var> is omitted, it is assumed to be
131     <code>=</code>.</p>
132 </usage>
133 </directivesynopsis>
134
135 </modulesynopsis>