1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
4 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
5 This file is generated from xml source: DO NOT EDIT
6 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
8 <title>mod_version - Apache HTTP Server</title>
9 <link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
10 <link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
11 <link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
12 <link href="../images/favicon.ico" rel="shortcut icon" /></head>
14 <div id="page-header">
15 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p>
16 <p class="apache">Apache HTTP Server Version 2.0</p>
17 <img alt="" src="../images/feather.gif" /></div>
18 <div class="up"><a href="./"><img title="<-" alt="<-" src="../images/left.gif" /></a></div>
20 <a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="../">Version 2.0</a> > <a href="./">Modules</a></div>
21 <div id="page-content">
22 <div id="preamble"><h1>Apache Module mod_version</h1>
24 <p><span>Available Languages: </span><a href="../en/mod/mod_version.html" title="English"> en </a> |
25 <a href="../ja/mod/mod_version.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
26 <a href="../ko/mod/mod_version.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p>
28 <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Version dependent configuration</td></tr>
29 <tr><th><a href="module-dict.html#Status">Status:</a></th><td>Extension</td></tr>
30 <tr><th><a href="module-dict.html#ModuleIdentifier">Module Identifier:</a></th><td>version_module</td></tr>
31 <tr><th><a href="module-dict.html#SourceFile">Source File:</a></th><td>mod_version.c</td></tr>
32 <tr><th><a href="module-dict.html#Compatibility">Compatibility:</a></th><td>Available in version 2.0.56 and later</td></tr></table>
35 <p>This module is designed for the use in test suites and large
36 networks which have to deal with different httpd versions and
37 different configurations. It provides a new container -- <code class="directive"><a href="#ifversion"><IfVersion></a></code>, which
38 allows a flexible version checking including numeric comparisons and
39 regular expressions.</p>
41 <div class="example"><h3>Examples</h3><p><code>
42 <IfVersion 2.1.0><br />
44 # current httpd version is exactly 2.1.0<br />
46 </IfVersion><br />
48 <IfVersion >= 2.2><br />
50 # use really new features :-)<br />
55 <p>See below for further possibilities.</p>
57 <div id="quickview"><h3 class="directives">Directives</h3>
59 <li><img alt="" src="../images/down.gif" /> <a href="#ifversion"><IfVersion></a></li>
63 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
64 <div class="directive-section"><h2><a name="IfVersion" id="IfVersion"><IfVersion></a> <a name="ifversion" id="ifversion">Directive</a></h2>
65 <table class="directive">
66 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>contains version dependent configuration</td></tr>
67 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><IfVersion [[!]<var>operator</var>] <var>version</var>> ...
68 </IfVersion></code></td></tr>
69 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
70 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
71 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
72 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_version</td></tr>
74 <p>The <code class="directive"><IfVersion></code> section encloses
75 configuration directives which are executed only if the
76 <code class="program"><a href="../programs/httpd.html">httpd</a></code> version
77 matches the desired criteria. For normal (numeric) comparisons the
78 <var>version</var> argument has the format
79 <code><var>major</var>[.<var>minor</var>[.<var>patch</var>]]</code>, e.g.
80 <code>2.1.0</code> or <code>2.2</code>. <var>minor</var> and
81 <var>patch</var> are optional. If these numbers are omitted, they are
82 assumed to be zero. The following numerical <var>operator</var>s are
85 <table class="bordered"><tr class="header"><th><var>operator</var></th><th>description</th></tr>
86 <tr><td><code>=</code> or <code>==</code></td>
87 <td>httpd version is equal</td></tr>
88 <tr class="odd"><td><code>></code></td>
89 <td>httpd version is greater than</td></tr>
90 <tr><td><code>>=</code></td>
91 <td>httpd version is greater or equal</td></tr>
92 <tr class="odd"><td><code><</code></td>
93 <td>httpd version is less than</td></tr>
94 <tr><td><code><=</code></td>
95 <td>httpd version is less or equal</td></tr>
98 <div class="example"><h3>Example</h3><p><code>
99 <IfVersion >= 2.1><br />
100 <span class="indent">
101 # this happens only in versions greater or<br />
107 <p>Besides the numerical comparison it is possible to match a regular
108 expression against the httpd version. There are two ways to write it:</p>
110 <table class="bordered"><tr class="header"><th><var>operator</var></th><th>description</th></tr>
111 <tr><td><code>=</code> or <code>==</code></td>
112 <td><var>version</var> has the form
113 <code>/<var>regex</var>/</code></td></tr>
114 <tr class="odd"><td><code>~</code></td>
115 <td><var>version</var> has the form
116 <code><var>regex</var></code></td></tr>
119 <div class="example"><h3>Example</h3><p><code>
120 <IfVersion = /^2.1.[01234]$/><br />
121 <span class="indent">
122 # e.g. workaround for buggy versions
127 <p>In order to reverse the meaning, all operators can be preceded by an
128 exclamation mark (<code>!</code>):</p>
130 <div class="example"><p><code>
131 <IfVersion !~ ^2.1.[01234]$><br />
132 <span class="indent">
133 # not for those versions<br />
138 <p>If the <var>operator</var> is omitted, it is assumed to be
143 <div class="bottomlang">
144 <p><span>Available Languages: </span><a href="../en/mod/mod_version.html" title="English"> en </a> |
145 <a href="../ja/mod/mod_version.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
146 <a href="../ko/mod/mod_version.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p>
147 </div><div id="footer">
148 <p class="apache">Copyright 2009 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
149 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div>