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 <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type" />
6 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
7 This file is generated from xml source: DO NOT EDIT
8 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
10 <title>mod_version - Apache HTTP Server Version 2.5</title>
11 <link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
12 <link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
13 <link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="../style/css/prettify.css" />
14 <script src="../style/scripts/prettify.min.js" type="text/javascript">
17 <link href="../images/favicon.ico" rel="shortcut icon" /></head>
19 <div id="page-header">
20 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/quickreference.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p>
21 <p class="apache">Apache HTTP Server Version 2.5</p>
22 <img alt="" src="../images/feather.png" /></div>
23 <div class="up"><a href="./"><img title="<-" alt="<-" src="../images/left.gif" /></a></div>
25 <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.5</a> > <a href="./">Modules</a></div>
26 <div id="page-content">
27 <div id="preamble"><h1>Apache Module mod_version</h1>
29 <p><span>Available Languages: </span><a href="../en/mod/mod_version.html" title="English"> en </a> |
30 <a href="../ja/mod/mod_version.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
31 <a href="../ko/mod/mod_version.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p>
33 <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Version dependent configuration</td></tr>
34 <tr><th><a href="module-dict.html#Status">Status:</a></th><td>Extension</td></tr>
35 <tr><th><a href="module-dict.html#ModuleIdentifier">Module Identifier:</a></th><td>version_module</td></tr>
36 <tr><th><a href="module-dict.html#SourceFile">Source File:</a></th><td>mod_version.c</td></tr></table>
39 <p>This module is designed for the use in test suites and large
40 networks which have to deal with different httpd versions and
41 different configurations. It provides a new container -- <code class="directive"><a href="#ifversion"><IfVersion></a></code>, which
42 allows a flexible version checking including numeric comparisons and
43 regular expressions.</p>
45 <div class="example"><h3>Examples</h3><pre class="prettyprint lang-config"><IfVersion 2.4.2>
46 # current httpd version is exactly 2.4.2
49 <IfVersion >= 2.5>
50 # use really new features :-)
51 </IfVersion></pre>
54 <p>See below for further possibilities.</p>
56 <div id="quickview"><h3 class="directives">Directives</h3>
58 <li><img alt="" src="../images/down.gif" /> <a href="#ifversion"><IfVersion></a></li>
60 <h3>Bugfix checklist</h3><ul class="seealso"><li><a href="https://www.apache.org/dist/httpd/CHANGES_2.4">httpd changelog</a></li><li><a href="https://bz.apache.org/bugzilla/buglist.cgi?bug_status=__open__&list_id=144532&product=Apache%20httpd-2&query_format=specific&order=changeddate%20DESC%2Cpriority%2Cbug_severity&component=mod_version">Known issues</a></li><li><a href="https://bz.apache.org/bugzilla/enter_bug.cgi?product=Apache%20httpd-2&component=mod_version">Report a bug</a></li></ul><ul class="seealso"><li><a href="#comments_section">Comments</a></li></ul></div>
62 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
63 <div class="directive-section"><h2><a name="IfVersion" id="IfVersion"><IfVersion></a> <a name="ifversion" id="ifversion">Directive</a></h2>
64 <table class="directive">
65 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>contains version dependent configuration</td></tr>
66 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><IfVersion [[!]<var>operator</var>] <var>version</var>> ...
67 </IfVersion></code></td></tr>
68 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
69 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>All</td></tr>
70 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
71 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_version</td></tr>
73 <p>The <code class="directive"><IfVersion></code> section encloses
74 configuration directives which are executed only if the
75 <code class="program"><a href="../programs/httpd.html">httpd</a></code> version
76 matches the desired criteria. For normal (numeric) comparisons the
77 <var>version</var> argument has the format
78 <code><var>major</var>[.<var>minor</var>[.<var>patch</var>]]</code>, e.g.
79 <code>2.1.0</code> or <code>2.2</code>. <var>minor</var> and
80 <var>patch</var> are optional. If these numbers are omitted, they are
81 assumed to be zero. The following numerical <var>operator</var>s are
84 <table class="bordered"><tr class="header"><th><var>operator</var></th><th>description</th></tr>
85 <tr><td><code>=</code> or <code>==</code></td>
86 <td>httpd version is equal</td></tr>
87 <tr class="odd"><td><code>></code></td>
88 <td>httpd version is greater than</td></tr>
89 <tr><td><code>>=</code></td>
90 <td>httpd version is greater or equal</td></tr>
91 <tr class="odd"><td><code><</code></td>
92 <td>httpd version is less than</td></tr>
93 <tr><td><code><=</code></td>
94 <td>httpd version is less or equal</td></tr>
97 <div class="example"><h3>Example</h3><pre class="prettyprint lang-config"><IfVersion >= 2.3>
98 # this happens only in versions greater or
100 </IfVersion></pre>
103 <p>Besides the numerical comparison it is possible to match a
104 <a class="glossarylink" href="../glossary.html#regex" title="see glossary">regular expression</a>
105 against the httpd version. There are two ways to write it:</p>
107 <table class="bordered"><tr class="header"><th><var>operator</var></th><th>description</th></tr>
108 <tr><td><code>=</code> or <code>==</code></td>
109 <td><var>version</var> has the form
110 <code>/<var>regex</var>/</code></td></tr>
111 <tr class="odd"><td><code>~</code></td>
112 <td><var>version</var> has the form
113 <code><var>regex</var></code></td></tr>
116 <div class="example"><h3>Example</h3><pre class="prettyprint lang-config"><IfVersion = /^2.4.[01234]$/>
117 # e.g. workaround for buggy versions
118 </IfVersion></pre>
121 <p>In order to reverse the meaning, all operators can be preceded by an
122 exclamation mark (<code>!</code>):</p>
124 <pre class="prettyprint lang-config"><IfVersion !~ ^2.4.[01234]$>
125 # not for those versions
126 </IfVersion></pre>
129 <p>If the <var>operator</var> is omitted, it is assumed to be
134 <div class="bottomlang">
135 <p><span>Available Languages: </span><a href="../en/mod/mod_version.html" title="English"> en </a> |
136 <a href="../ja/mod/mod_version.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a> |
137 <a href="../ko/mod/mod_version.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p>
138 </div><div class="top"><a href="#page-header"><img src="../images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div>
139 <script type="text/javascript"><!--//--><![CDATA[//><!--
140 var comments_shortname = 'httpd';
141 var comments_identifier = 'http://httpd.apache.org/docs/trunk/mod/mod_version.html';
143 if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
144 d.write('<div id="comments_thread"><\/div>');
145 var s = d.createElement('script');
146 s.type = 'text/javascript';
148 s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
149 (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
152 d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
154 })(window, document);
155 //--><!]]></script></div><div id="footer">
156 <p class="apache">Copyright 2016 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>
157 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/quickreference.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!--
158 if (typeof(prettyPrint) !== 'undefined') {