expr.html.en revision 33cc86a567a0a9967470f5cdba8c856d2e1ce3b7
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
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<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>
af33a4994ae2ff15bc67d19ff1a7feb906745bf8rbowen<div class="up"><a href="./"><img title="<-" alt="<-" src="/images/left.gif" /></a></div>
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere<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.3</a></div><div id="page-content"><div id="preamble"><h1>Expressions in Apache HTTP Server</h1>
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere<p><span>Available Languages: </span><a href="/en/expr.html" title="English"> en </a></p>
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.
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<h2><a name="grammar" id="grammar">Grammar in BNF notation</a></h2>
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor<blockquote>
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclereexpr ::= "<strong>true</strong>" | "<strong>false</strong>"
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclerecomp ::= stringcomp
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere | integercomp
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere | unaryop word
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor | word binaryop word
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere | word "<strong>in</strong>" "<strong>{</strong>" wordlist "<strong>}</strong>"
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
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclerewordlist ::= word
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere | rebackref
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclerestring ::= stringpart
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere | string stringpart
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclerestringpart ::= cstring
fabd4bc0c499704e644a74f78cc3871436824ea0jim | rebackref
4126704c4950bfd46d32ad54e3b106ac6d868a73sfcstring ::= ...
fabd4bc0c499704e644a74f78cc3871436824ea0jimdigit ::= [0-9]+
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclerevariable ::= "<strong>%{</strong>" varname "<strong>}</strong>"
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere | "<strong>%{</strong>" funcname "<strong>:</strong>" funcargs "<strong>}</strong>"
fabd4bc0c499704e644a74f78cc3871436824ea0jimfunction ::= funcname "<strong>(</strong>" word "<strong>)</strong>"
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclerelistfunction ::= listfuncname "<strong>(</strong>" word "<strong>)</strong>"
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor</blockquote>
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
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"><If ></code>
173e5f4d5ec46b5febb74ce860d753bb1faaba0fsf directive is evaluated before authentication is done. Therefore,
173e5f4d5ec46b5febb74ce860d753bb1faaba0fsf <code>%{REMOTE_USER}</code> will not be set in this case.</p>
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 <table class="bordered"><tr class="header"><th>Name</th></tr>
173e5f4d5ec46b5febb74ce860d753bb1faaba0fsf<tr class="odd"><td><code>HTTP_PROXY_CONNECTION</code></td></tr>
173e5f4d5ec46b5febb74ce860d753bb1faaba0fsf<tr class="odd"><td><code>HTTP_USER_AGENT</code></td></tr>
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor <table class="bordered"><tr class="header"><th>Name</th><th>Description</th></tr>
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere <td>The user name of the owner of the script.</td></tr>
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere <td>The group name of the group of the script.</td></tr>
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere <td>The query string of the current request</td></tr>
e3659090e9bb9934465dbb6c6212ba4c512190b0jfclere <td>"<code>true</code>" if the current request is a subrequest,
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor <td>The name of the authenticated user (if any)</td></tr>
72c2f500f39311ecf8f08449f2bfbb85e46f2e8elgentis <td>The user name set by <code class="module"><a href="/mod/mod_ident.html">mod_ident</a></code></td></tr>
72c2f500f39311ecf8f08449f2bfbb85e46f2e8elgentis <td>The <code class="directive"><a href="/mod/core.html#servername">ServerName</a></code> of
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 <td>The <code class="directive"><a href="/mod/core.html#serveradmin">ServerAdmin</a></code> of
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor <td>The <code class="directive"><a href="/mod/core.html#documentroot">DocumentRoot</a></code> of
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor <td>The configured <code class="directive"><a href="/mod/mod_authn_core.html#authtype">AuthType</a></code>
999942e8e84bcae9b439ab30a040b1b997b343c9gryzor <td>The name of the <a href="handler.html">handler</a> creating
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 <td>The error log id of the connection (see
727872d18412fc021f03969b8641810d8896820bhumbedooh <code class="directive"><a href="/mod/core.html#errorlogformat">ErrorLogFormat</a></code>)</td></tr>
cc7e1025de9ac63bd4db6fe7f71c158b2cf09fe4humbedooh <table class="bordered"><tr class="header"><th>Name</th><th>Description</th></tr>
0d0ba3a410038e179b695446bb149cce6264e0abnd <td>The current month (<code>1</code>, ..., <code>12</code>)</td></tr>
0d0ba3a410038e179b695446bb149cce6264e0abnd <td>The hour part of the current time
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd <td>The date and time in the format <code>20101231235959</code></td></tr>
<p>Some modules register additional variables, see e.g. <code class="module"><a href="/mod/mod_ssl.html">mod_ssl</a></code>.</p>
<table class="bordered"><tr class="header"><th>Name</th><th>Alternative</th> <th>Description</th></tr>
<td>Unescape %hex encoded string, leaving URL-special characters encoded (XXX: describe better)</td></tr>
take one string as argument and return a wordlist, i.e. a list of strings. The wordlist
<p>There are no built-in list-valued functions. <code class="module"><a href="/mod/mod_ssl.html">mod_ssl</a></code>
<table class="bordered"><tr class="header"><th>Name</th><th>Alternative</th> <th>Description</th></tr>
<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>