regular expressions.</p>
<example><title>Examples</title>
- <IfVersion 2.1.0><br />
- <indent>
- # current httpd version is exactly 2.1.0<br />
- </indent>
- </IfVersion><br />
- <br />
- <IfVersion >= 2.2><br />
- <indent>
- # use really new features :-)<br />
- </indent>
- </IfVersion>
+ <highlight language="config">
+<IfVersion 2.4.2>
+ # current httpd version is exactly 2.4.2
+</IfVersion>
+
+<IfVersion >= 2.5>
+ # use really new features :-)
+</IfVersion>
+ </highlight>
</example>
<p>See below for further possibilities.</p>
</table>
<example><title>Example</title>
- <IfVersion >= 2.1><br />
- <indent>
- # this happens only in versions greater or<br />
- # equal 2.1.0.<br />
- </indent>
- </IfVersion>
+ <highlight language="config">
+<IfVersion >= 2.3>
+ # this happens only in versions greater or
+ # equal 2.3.0.
+</IfVersion>
+ </highlight>
</example>
<p>Besides the numerical comparison it is possible to match a
</table>
<example><title>Example</title>
- <IfVersion = /^2.1.[01234]$/><br />
- <indent>
- # e.g. workaround for buggy versions
- </indent>
- </IfVersion>
+ <highlight language="config">
+<IfVersion = /^2.4.[01234]$/>
+ # e.g. workaround for buggy versions
+</IfVersion>
+ </highlight>
</example>
<p>In order to reverse the meaning, all operators can be preceded by an
exclamation mark (<code>!</code>):</p>
- <example>
- <IfVersion !~ ^2.1.[01234]$><br />
- <indent>
- # not for those versions<br />
- </indent>
- </IfVersion>
- </example>
+ <highlight language="config">
+<IfVersion !~ ^2.4.[01234]$>
+ # not for those versions
+</IfVersion>
+ </highlight>
<p>If the <var>operator</var> is omitted, it is assumed to be
<code>=</code>.</p>
/cgi-bin/script.pl</code> to <code>
/usr/local/apache2/cgi-bin/script.pl</code> in all cases:</p>
- <example>
- ScriptAlias /cgi-bin/ /usr/local/apache2/cgi-bin/<br />
- VirtualScriptAlias /never/found/%0/cgi-bin/
- </example>
+ <highlight language="config">
+ScriptAlias /cgi-bin/ /usr/local/apache2/cgi-bin/
+VirtualScriptAlias /never/found/%0/cgi-bin/
+ </highlight>
</note>
</summary>
<p>For simple name-based virtual hosts you might use the
following directives in your server configuration file:</p>
- <example>
- UseCanonicalName Off<br />
- VirtualDocumentRoot /usr/local/apache/vhosts/%0
- </example>
+ <highlight language="config">
+UseCanonicalName Off
+VirtualDocumentRoot /usr/local/apache/vhosts/%0
+ </highlight>
<p>A request for
<code>http://www.example.com/directory/file.html</code> will be
<code>vhosts</code> directory. To do this you might use the
following in your configuration file:</p>
- <example>
- UseCanonicalName Off<br />
- VirtualDocumentRoot /usr/local/apache/vhosts/%3+/%2.1/%2.2/%2.3/%2
- </example>
+ <highlight language="config">
+UseCanonicalName Off
+VirtualDocumentRoot /usr/local/apache/vhosts/%3+/%2.1/%2.2/%2.3/%2
+ </highlight>
<p>A request for
<code>http://www.domain.example.com/directory/file.html</code>
<p>A more even spread of files can be achieved by hashing from the
end of the name, for example: </p>
-<example>
+<highlight language="config">
VirtualDocumentRoot /usr/local/apache/vhosts/%3+/%2.-1/%2.-2/%2.-3/%2
-</example>
+</highlight>
<p>The example request would come from
<code>/usr/local/apache/vhosts/example.com/n/i/a/domain/directory/file.html</code>.</p>
<p>Alternatively you might use: </p>
-<example>
+<highlight language="config">
VirtualDocumentRoot /usr/local/apache/vhosts/%3+/%2.1/%2.2/%2.3/%2.4+
-</example>
+</highlight>
<p>The example request would come from
<code>/usr/local/apache/vhosts/example.com/d/o/m/ain/directory/file.html</code>.</p>
<p>For IP-based virtual hosting you might use the following in
your configuration file:</p>
- <example>
- UseCanonicalName DNS<br />
- VirtualDocumentRootIP /usr/local/apache/vhosts/%1/%2/%3/%4/docs<br />
- VirtualScriptAliasIP /usr/local/apache/vhosts/%1/%2/%3/%4/cgi-bin
- </example>
+ <highlight language="config">
+UseCanonicalName DNS
+VirtualDocumentRootIP /usr/local/apache/vhosts/%1/%2/%3/%4/docs
+VirtualScriptAliasIP /usr/local/apache/vhosts/%1/%2/%3/%4/cgi-bin
+ </highlight>
<p>A request for
<code>http://www.domain.example.com/directory/file.html</code>
a <code>%</code> directive, you can work around the problem in
the following way:</p>
-<example>
+<highlight language="config">
VirtualDocumentRoot /usr/local/apache/vhosts/%2.0.%3.0
-</example>
+</highlight>
<p>A request for
<code>http://www.domain.example.com/directory/file.html</code>