expr.html.en revision 33cc86a567a0a9967470f5cdba8c856d2e1ce3b7
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere<?xml version="1.0" encoding="ISO-8859-1"?>
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere This file is generated from xml source: DO NOT EDIT
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere -->
96ad5d81ee4a2cc66a4ae19893efc8aa6d06fae7jailletc<title>Expressions in Apache HTTP Server - Apache HTTP Server</title>
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere<link href="/style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere<link href="/style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen<link href="/style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
2e545ce2450a9953665f701bb05350f0d3f26275nd<link href="/images/favicon.ico" rel="shortcut icon" /></head>
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen<body id="manual-page"><div id="page-header">
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen<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>
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere<p class="apache">Apache HTTP Server Version 2.3</p>
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere<img alt="" src="/images/feather.gif" /></div>
af33a4994ae2ff15bc67d19ff1a7feb906745bf8rbowen<div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="/images/left.gif" /></a></div>
3f08db06526d6901aa08c110b5bc7dde6bc39905nd<div id="path">
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere<a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs/">Documentation</a> &gt; <a href="./">Version 2.3</a></div><div id="page-content"><div id="preamble"><h1>Expressions in Apache HTTP Server</h1>
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere<div class="toplang">
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere<p><span>Available Languages: </span><a href="/en/expr.html" title="English">&nbsp;en&nbsp;</a></p>
3f08db06526d6901aa08c110b5bc7dde6bc39905nd</div>
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere <p>Historically, there are several syntax variants for expressions used to express
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere a condition in the different modules of the Apache HTTP Server.
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere There is some ongoing effort to only use a single variant, called <em>ap_expr</em>,
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere for all configuration directives.
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere This document describes the <em>ap_expr</em> expression parser.
fac8c35bfb158112226ab43ddf84d59daca5dc30nd </p>
d474d8ef01ec5c2a09341cd148851ed383c3287crbowen </div>
d474d8ef01ec5c2a09341cd148851ed383c3287crbowen<div id="quickview"><ul id="toc"><li><img alt="" src="/images/down.gif" /> <a href="#grammar">Grammar in BNF notation</a></li>
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere<li><img alt="" src="/images/down.gif" /> <a href="#vars">Variables</a></li>
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere<li><img alt="" src="/images/down.gif" /> <a href="#binop">Binary operators</a></li>
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere<li><img alt="" src="/images/down.gif" /> <a href="#unnop">Unary operators</a></li>
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere<li><img alt="" src="/images/down.gif" /> <a href="#functions">Functions</a></li>
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere<li><img alt="" src="/images/down.gif" /> <a href="#other">Other</a></li>
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere</ul><h3>See also</h3><ul class="seealso"><li><code class="directive"><a href="/mod/core.html#if">If</a></code></li><li><code class="module"><a href="/mod/mod_rewrite.html">mod_rewrite</a></code></li><li><code class="module"><a href="/mod/mod_include.html">mod_include</a></code></li><li><code class="module"><a href="/mod/mod_setenvif.html">mod_setenvif</a></code></li><li><code class="directive"><a href="/mod/mod_ssl.html#sslrequire">SSLRequire</a></code></li><li><code class="directive"><a href="/mod/mod_filter.html#filterprovider">FilterProvider</a></code></li></ul></div>
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor<div class="section">
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor<h2><a name="grammar" id="grammar">Grammar in BNF notation</a></h2>
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor<blockquote>
30471a4650391f57975f60bbb6e4a90be7b284bfhumbedooh<pre>
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclereexpr ::= "<strong>true</strong>" | "<strong>false</strong>"
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere | "<strong>!</strong>" expr
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere | expr "<strong>&amp;&amp;</strong>" expr
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere | expr "<strong>||</strong>" expr
fabd4bc0c499704e644a74f78cc3871436824ea0jim | "<strong>(</strong>" expr "<strong>)</strong>"
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere | comp
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclerecomp ::= stringcomp
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere | integercomp
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere | unaryop word
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor | word binaryop word
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere | word "<strong>in</strong>" "<strong>{</strong>" wordlist "<strong>}</strong>"
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere | word "<strong>in</strong>" listfunction
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere | word "<strong>=~</strong>" regex
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere | word "<strong>!~</strong>" regex
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere
fabd4bc0c499704e644a74f78cc3871436824ea0jim
999942e8e84bcae9b439ab30a040b1b997b343c9gryzorstringcomp ::= word "<strong>==</strong>" word
bed3c2e56e8f3328e780200466b9d009093db468sf | word "<strong>!=</strong>" word
bed3c2e56e8f3328e780200466b9d009093db468sf | word "<strong>&lt;</strong>" word
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere | word "<strong>&lt;=</strong>" word
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere | word "<strong>&gt;</strong>" word
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere | word "<strong>&gt;=</strong>" word
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclereintegercomp ::= word "<strong>-eq</strong>" word | word "<strong>eq</strong>" word
591f748210dc55f2972482dddc84bb6bac61d6b9noodl | word "<strong>-ne</strong>" word | word "<strong>ne</strong>" word
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere | word "<strong>-lt</strong>" word | word "<strong>lt</strong>" word
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere | word "<strong>-le</strong>" word | word "<strong>le</strong>" word
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor | word "<strong>-gt</strong>" word | word "<strong>gt</strong>" word
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere | word "<strong>-ge</strong>" word | word "<strong>ge</strong>" word
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclerewordlist ::= word
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere | wordlist "<strong>,</strong>" word
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclereword ::= word "<strong>.</strong>" word
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere | digit
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere | "<strong>'</strong>" string "<strong>'</strong>"
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere | "<strong>"</strong>" string "<strong>"</strong>"
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere | variable
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere | rebackref
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere | function
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclerestring ::= stringpart
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere | string stringpart
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclerestringpart ::= cstring
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor | variable
fabd4bc0c499704e644a74f78cc3871436824ea0jim | rebackref
fabd4bc0c499704e644a74f78cc3871436824ea0jim
4126704c4950bfd46d32ad54e3b106ac6d868a73sfcstring ::= ...
fabd4bc0c499704e644a74f78cc3871436824ea0jimdigit ::= [0-9]+
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclerevariable ::= "<strong>%{</strong>" varname "<strong>}</strong>"
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere | "<strong>%{</strong>" funcname "<strong>:</strong>" funcargs "<strong>}</strong>"
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor
999942e8e84bcae9b439ab30a040b1b997b343c9gryzorrebackref ::= "<strong>$</strong>" [0-9]
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor
fabd4bc0c499704e644a74f78cc3871436824ea0jimfunction ::= funcname "<strong>(</strong>" word "<strong>)</strong>"
fabd4bc0c499704e644a74f78cc3871436824ea0jim
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclerelistfunction ::= listfuncname "<strong>(</strong>" word "<strong>)</strong>"
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor</pre>
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor</blockquote>
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor<div class="section">
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor<h2><a name="vars" id="vars">Variables</a></h2>
173e5f4d5ec46b5febb74ce860d753bb1faaba0fsf
173e5f4d5ec46b5febb74ce860d753bb1faaba0fsf
173e5f4d5ec46b5febb74ce860d753bb1faaba0fsf <p>The expression parser provides a number of variables of the form
173e5f4d5ec46b5febb74ce860d753bb1faaba0fsf <code>%{HTTP_HOST}</code>. Note that the value of a variable may depend
173e5f4d5ec46b5febb74ce860d753bb1faaba0fsf on the phase of the request processing in which it is evaluated. For
173e5f4d5ec46b5febb74ce860d753bb1faaba0fsf example, an expression used in an <code class="directive">&lt;If &gt;</code>
173e5f4d5ec46b5febb74ce860d753bb1faaba0fsf directive is evaluated before authentication is done. Therefore,
173e5f4d5ec46b5febb74ce860d753bb1faaba0fsf <code>%{REMOTE_USER}</code> will not be set in this case.</p>
173e5f4d5ec46b5febb74ce860d753bb1faaba0fsf
173e5f4d5ec46b5febb74ce860d753bb1faaba0fsf <p>The following variables provide the values of the named HTTP request
173e5f4d5ec46b5febb74ce860d753bb1faaba0fsf headers. The values of other headers can be obtained witht the
173e5f4d5ec46b5febb74ce860d753bb1faaba0fsf <code>req</code> <a href="#functions">function</a>.</p>
173e5f4d5ec46b5febb74ce860d753bb1faaba0fsf
173e5f4d5ec46b5febb74ce860d753bb1faaba0fsf <table class="bordered"><tr class="header"><th>Name</th></tr>
173e5f4d5ec46b5febb74ce860d753bb1faaba0fsf<tr><td><code>HTTP_ACCEPT</code></td></tr>
173e5f4d5ec46b5febb74ce860d753bb1faaba0fsf<tr class="odd"><td><code>HTTP_FORWARDED</code></td></tr>
173e5f4d5ec46b5febb74ce860d753bb1faaba0fsf<tr><td><code>HTTP_HOST</code></td></tr>
173e5f4d5ec46b5febb74ce860d753bb1faaba0fsf<tr class="odd"><td><code>HTTP_PROXY_CONNECTION</code></td></tr>
173e5f4d5ec46b5febb74ce860d753bb1faaba0fsf<tr><td><code>HTTP_REFERER</code></td></tr>
173e5f4d5ec46b5febb74ce860d753bb1faaba0fsf<tr class="odd"><td><code>HTTP_USER_AGENT</code></td></tr>
173e5f4d5ec46b5febb74ce860d753bb1faaba0fsf</table>
173e5f4d5ec46b5febb74ce860d753bb1faaba0fsf
173e5f4d5ec46b5febb74ce860d753bb1faaba0fsf <p>Other request related variables</p>
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor <table class="bordered"><tr class="header"><th>Name</th><th>Description</th></tr>
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor<tr><td><code>REQUEST_METHOD</code></td>
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor <td>The HTTP method of the incoming request (e.g.
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere <code>GET</code>)</td></tr>
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor<tr class="odd"><td><code>REQUEST_SCHEME</code></td>
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor <td>The scheme part of the request's URI</td></tr>
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor<tr><td><code>REQUEST_URI</code></td>
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor <td>The URI of the request</td></tr>
fabd4bc0c499704e644a74f78cc3871436824ea0jim<tr class="odd"><td><code>REQUEST_FILENAME</code></td>
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor <td /></tr>
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor<tr><td><code>SCRIPT_FILENAME</code></td>
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor <td>Same as <code>REQUEST_FILENAME</code></td></tr>
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere<tr class="odd"><td><code>SCRIPT_USER</code></td>
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere <td>The user name of the owner of the script.</td></tr>
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere<tr><td><code>SCRIPT_GROUP</code></td>
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere <td>The group name of the group of the script.</td></tr>
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere<tr class="odd"><td><code>PATH_INFO</code></td>
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere <td /></tr>
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere<tr><td><code>QUERY_STRING</code></td>
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere <td>The query string of the current request</td></tr>
9a58dc6a2b26ec128b1270cf48810e705f1a90dbsf<tr class="odd"><td><code>IS_SUBREQ</code></td>
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere <td>"<code>true</code>" if the current request is a subrequest,
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere "<code>false</code>" otherwise</td></tr>
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor<tr><td><code>THE_REQUEST</code></td>
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor <td>The complete request line (e.g.,
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere "<code>GET /index.html HTTP/1.1</code>")</td></tr>
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor<tr class="odd"><td><code>REMOTE_ADDR</code></td>
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor <td>The IP address of the remote host</td></tr>
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor<tr><td><code>REMOTE_HOST</code></td>
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor <td>The host name of the remote host</td></tr>
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor<tr class="odd"><td><code>REMOTE_USER</code></td>
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor <td>The name of the authenticated user (if any)</td></tr>
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere<tr><td><code>REMOTE_IDENT</code></td>
72c2f500f39311ecf8f08449f2bfbb85e46f2e8elgentis <td>The user name set by <code class="module"><a href="/mod/mod_ident.html">mod_ident</a></code></td></tr>
72c2f500f39311ecf8f08449f2bfbb85e46f2e8elgentis<tr class="odd"><td><code>SERVER_NAME</code></td>
72c2f500f39311ecf8f08449f2bfbb85e46f2e8elgentis <td>The <code class="directive"><a href="/mod/core.html#servername">ServerName</a></code> of
72c2f500f39311ecf8f08449f2bfbb85e46f2e8elgentis the current vhost</td></tr>
72c2f500f39311ecf8f08449f2bfbb85e46f2e8elgentis<tr><td><code>SERVER_PORT</code></td>
72c2f500f39311ecf8f08449f2bfbb85e46f2e8elgentis <td>The server port of the current vhost, see
72c2f500f39311ecf8f08449f2bfbb85e46f2e8elgentis <code class="directive"><a href="/mod/core.html#servername">ServerName</a></code></td></tr>
72c2f500f39311ecf8f08449f2bfbb85e46f2e8elgentis<tr class="odd"><td><code>SERVER_ADMIN</code></td>
72c2f500f39311ecf8f08449f2bfbb85e46f2e8elgentis <td>The <code class="directive"><a href="/mod/core.html#serveradmin">ServerAdmin</a></code> of
72c2f500f39311ecf8f08449f2bfbb85e46f2e8elgentis the current vhost</td></tr>
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor<tr><td><code>SERVER_PROTOCOL</code></td>
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor <td>The protocol used by the request</td></tr>
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor<tr class="odd"><td><code>DOCUMENT_ROOT</code></td>
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor <td>The <code class="directive"><a href="/mod/core.html#documentroot">DocumentRoot</a></code> of
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor the current vhost</td></tr>
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor<tr><td><code>AUTH_TYPE</code></td>
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor <td>The configured <code class="directive"><a href="/mod/mod_authn_core.html#authtype">AuthType</a></code>
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor (e.g. "<code>basic</code>")</td></tr>
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor<tr class="odd"><td><code>CONTENT_TYPE</code></td>
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor <td>The content type of the response</td></tr>
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor<tr><td><code>HANDLER</code></td>
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor <td>The name of the <a href="handler.html">handler</a> creating
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor the response</td></tr>
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere<tr class="odd"><td><code>HTTPS</code></td>
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere <td>"<code>on</code>" if the request uses https,
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere "<code>off</code>" otherwise</td></tr>
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere<tr><td><code>IPV6</code></td>
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere <td>"<code>on</code>" if the connection uses IPv6,
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere "<code>off</code>" otherwise</td></tr>
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere<tr class="odd"><td><code>REQUEST_LOG_ID</code></td>
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere <td>The error log id of the request (see
fac8c35bfb158112226ab43ddf84d59daca5dc30nd <code class="directive"><a href="/mod/core.html#errorlogformat">ErrorLogFormat</a></code>)</td></tr>
d474d8ef01ec5c2a09341cd148851ed383c3287crbowen<tr><td><code>CONN_LOG_ID</code></td>
d474d8ef01ec5c2a09341cd148851ed383c3287crbowen <td>The error log id of the connection (see
727872d18412fc021f03969b8641810d8896820bhumbedooh <code class="directive"><a href="/mod/core.html#errorlogformat">ErrorLogFormat</a></code>)</td></tr>
0d0ba3a410038e179b695446bb149cce6264e0abnd</table>
727872d18412fc021f03969b8641810d8896820bhumbedooh
cc7e1025de9ac63bd4db6fe7f71c158b2cf09fe4humbedooh <p>Misc variables</p>
0d0ba3a410038e179b695446bb149cce6264e0abnd
cc7e1025de9ac63bd4db6fe7f71c158b2cf09fe4humbedooh <table class="bordered"><tr class="header"><th>Name</th><th>Description</th></tr>
727872d18412fc021f03969b8641810d8896820bhumbedooh<tr><td><code>TIME_YEAR</code></td>
0d0ba3a410038e179b695446bb149cce6264e0abnd <td>The current year (e.g. <code>2010</code>)</td></tr>
0d0ba3a410038e179b695446bb149cce6264e0abnd<tr class="odd"><td><code>TIME_MON</code></td>
0d0ba3a410038e179b695446bb149cce6264e0abnd <td>The current month (<code>1</code>, ..., <code>12</code>)</td></tr>
ac082aefa89416cbdc9a1836eaf3bed9698201c8humbedooh<tr><td><code>TIME_DAY</code></td>
0d0ba3a410038e179b695446bb149cce6264e0abnd <td>The current day of the month</td></tr>
0d0ba3a410038e179b695446bb149cce6264e0abnd<tr class="odd"><td><code>TIME_HOUR</code></td>
0d0ba3a410038e179b695446bb149cce6264e0abnd <td>The hour part of the current time
727872d18412fc021f03969b8641810d8896820bhumbedooh (<code>0</code>, ..., <code>23</code>)</td></tr>
0d0ba3a410038e179b695446bb149cce6264e0abnd<tr><td><code>TIME_MIN</code></td>
0d0ba3a410038e179b695446bb149cce6264e0abnd <td>The minute part of the current time </td></tr>
30471a4650391f57975f60bbb6e4a90be7b284bfhumbedooh<tr class="odd"><td><code>TIME_SEC</code></td>
205f749042ed530040a4f0080dbcb47ceae8a374rjung <td>The second part of the current time </td></tr>
af33a4994ae2ff15bc67d19ff1a7feb906745bf8rbowen<tr><td><code>TIME_WDAY</code></td>
0d0ba3a410038e179b695446bb149cce6264e0abnd <td>The day of the week (starting with <code>0</code>
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd for Sunday)</td></tr>
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd<tr class="odd"><td><code>TIME</code></td>
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd <td>The date and time in the format <code>20101231235959</code></td></tr>
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere<tr><td><code>SERVER_SOFTWARE</code></td>
<td>The server version string</td></tr>
<tr class="odd"><td><code>API_VERSION</code></td>
<td>The date of the API version (module magic number)</td></tr>
</table>
<p>Some modules register additional variables, see e.g. <code class="module"><a href="/mod/mod_ssl.html">mod_ssl</a></code>.</p>
</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
<div class="section">
<h2><a name="binop" id="binop">Binary operators</a></h2>
<p>With the exception of some built-in comparison operators, binary
operators have the form "<code>-[a-zA-Z][a-zA-Z0-9_]+</code>", i.e. a
minus and at least two characters. The name is not case sensitive.
Modules may register additional binary operators.</p>
<h3><a name="comp" id="comp">Comparison operators</a></h3>
<table class="bordered"><tr class="header"><th>Name</th><th>Alternative</th> <th>Description</th></tr>
<tr><td><code>==</code></td>
<td><code>=</code></td>
<td>String equality</td></tr>
<tr class="odd"><td><code>!=</code></td>
<td />
<td>String inequality</td></tr>
<tr><td><code>&lt;</code></td>
<td />
<td>String less than</td></tr>
<tr class="odd"><td><code>&lt;=</code></td>
<td />
<td>String less than or equal</td></tr>
<tr><td><code>&gt;</code></td>
<td />
<td>String greater than</td></tr>
<tr class="odd"><td><code>&gt;=</code></td>
<td />
<td>String greater than or equal</td></tr>
<tr><td><code>-eq</code></td>
<td><code>eq</code></td>
<td>Integer equality</td></tr>
<tr class="odd"><td><code>-ne</code></td>
<td><code>ne</code></td>
<td>Integer inequality</td></tr>
<tr><td><code>-lt</code></td>
<td><code>lt</code></td>
<td>Integer less than</td></tr>
<tr class="odd"><td><code>-le</code></td>
<td><code>le</code></td>
<td>Integer less than or equal</td></tr>
<tr><td><code>-gt</code></td>
<td><code>gt</code></td>
<td>Integer greater than</td></tr>
<tr class="odd"><td><code>-ge</code></td>
<td><code>ge</code></td>
<td>Integer greater than or equal</td></tr>
</table>
<h3><a name="binaryother" id="binaryother">Other binary operators</a></h3>
<table class="bordered"><tr class="header"><th>Name</th><th>Description</th></tr>
<tr><td><code>-ipmatch</code></td>
<td>IP address matches address/netmask</td></tr>
<tr class="odd"><td><code>-strmatch</code></td>
<td>left string matches pattern given by right string (containing
wildcards *, ?, [])</td></tr>
<tr><td><code>-strcmatch</code></td>
<td>same as <code>-strmatch</code>, but case insensitive</td></tr>
<tr class="odd"><td><code>-fnmatch</code></td>
<td>same as <code>-strmatch</code>, but slashes are not matched by
wildcards</td></tr>
</table>
</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
<div class="section">
<h2><a name="unnop" id="unnop">Unary operators</a></h2>
<p>Unary operators have the form "<code>-[a-zA-Z]</code>", i.e. a
minus and one character. The name <em>is</em> case sensitive.
Modules may register additional unary operators.</p>
<table class="bordered"><tr class="header"><th>Name</th><th>Description</th></tr>
<tr><td><code>-n</code></td>
<td>True if string is not empty</td></tr>
<tr class="odd"><td><code>-z</code></td>
<td>True if string is empty</td></tr>
<tr><td><code>-T</code></td>
<td>False if string is empty, "<code>0</code>", "<code>off</code>",
"<code>false</code>", or "<code>no</code>" (case insensitive).
True otherwise.</td></tr>
<tr class="odd"><td><code>-R</code></td>
<td>Same as "<code>%{REMOTE_ADDR} -ipmatch ...</code>", but more efficient
</td></tr>
</table>
</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
<div class="section">
<h2><a name="functions" id="functions">Functions</a></h2>
<p>Normal string-valued functions take one string as argument and return
a string. Functions names are not case sensitive.
Modules may register additional functions.</p>
<table class="bordered"><tr class="header"><th>Name</th><th>Description</th></tr>
<tr><td><code>req</code>, <code>http</code></td>
<td>Get HTTP request header</td></tr>
<tr class="odd"><td><code>resp</code></td>
<td>Get HTTP response header</td></tr>
<tr><td><code>reqenv</code></td>
<td>Lookup request environment variable</td></tr>
<tr class="odd"><td><code>osenv</code></td>
<td>Lookup operating system environment variable</td></tr>
<tr><td><code>note</code></td>
<td>Lookup request note</td></tr>
<tr class="odd"><td><code>env</code></td>
<td>Return first match of <code>note</code>, <code>reqenv</code>,
<code>osenv</code></td></tr>
<tr><td><code>tolower</code></td>
<td>Convert string to lower case</td></tr>
<tr class="odd"><td><code>toupper</code></td>
<td>Convert string to uppser case</td></tr>
<tr><td><code>escape</code></td>
<td>Escape special characters in %hex encoding</td></tr>
<tr class="odd"><td><code>unescape</code></td>
<td>Unescape %hex encoded string, leaving URL-special characters encoded (XXX: describe better)</td></tr>
<tr><td><code>file</code></td>
<td>Read contents from a file</td></tr>
</table>
<p>In addition to string-valued functions, there are also list-valued functions which
take one string as argument and return a wordlist, i.e. a list of strings. The wordlist
can be used with the special <code>-in</code> operator.
Functions names are not case sensitive.
Modules may register additional functions.</p>
<p>There are no built-in list-valued functions. <code class="module"><a href="/mod/mod_ssl.html">mod_ssl</a></code>
provides <code>PeerExtList</code>. See the description of
<code class="directive"><a href="/mod/mod_ssl.html#sslrequire">SSLRequire</a></code> for details
(but <code>PeerExtList</code> is also usable outside
of <code class="directive"><a href="/mod/mod_ssl.html#sslrequire">SSLRequire</a></code>).</p>
</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
<div class="section">
<h2><a name="other" id="other">Other</a></h2>
<table class="bordered"><tr class="header"><th>Name</th><th>Alternative</th> <th>Description</th></tr>
<tr><td><code>-in</code></td>
<td><code>in</code></td>
<td>string contained in string list</td></tr>
<tr class="odd"><td><code>/regexp/</code></td>
<td><code>m#regexp#</code></td>
<td>Regular expression (the second form allows different delimiters than /)</td></tr>
<tr><td><code>/regexp/i</code></td>
<td><code>m#regexp#i</code></td>
<td>Case insensitive regular expression</td></tr>
<tr class="odd"><td><code>$0 ... $9</code></td>
<td />
<td>Regular expression backreferences</td></tr>
</table>
<h3><a name="rebackref" id="rebackref">Regular expression backreferences</a></h3>
<p>The strings <code>$0</code> ... <code>$9</code> allow to reference
the capture groups from a previously executed, successfully
matching regular expressions. They can normally only be used in the
same expression as the matching regex, but some modules allow special
uses.</p>
</div></div>
<div class="bottomlang">
<p><span>Available Languages: </span><a href="/en/expr.html" title="English">&nbsp;en&nbsp;</a></p>
</div><div id="footer">
<p class="apache">Copyright 2011 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>
<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>
</body></html>