XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
This file is generated from xml source: DO NOT EDIT
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
- --><title>mod_rewrite - Apache HTTP Server</title><link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" /><link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" /><link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link href="../images/favicon.ico" rel="shortcut icon" /></head><body><div id="page-header"><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><p class="apache">Apache HTTP Server Version 2.0</p><img alt="" src="../images/feather.gif" /></div><div class="up"><a href="./"><img title="<-" alt="<-" src="../images/left.gif" /></a></div><div id="path"><a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs-project/">Documentation</a> > <a href="../">Version 2.0</a> > <a href="./">Modules</a></div><div id="page-content"><div id="preamble"><h1>Apache Module mod_rewrite</h1><table class="module"><tr><th><a href="module-dict.html#Description">Description:
- </a></th><td>Provides a rule-based rewriting engine to rewrite requested
-URLs on the fly</td></tr><tr><th><a href="module-dict.html#Status">Status:
- </a></th><td>Extension</td></tr><tr><th><a href="module-dict.html#ModuleIdentifier">Module Identifier:
- </a></th><td>rewrite_module</td></tr><tr><th><a href="module-dict.html#SourceFile">Source File:
- </a></th><td>mod_rewrite.c</td></tr><tr><th><a href="module-dict.html#Compatibility">Compatibility:
- </a></th><td>Available in Apache 1.3 and later</td></tr></table><h3>Summary</h3>
+ -->
+<title>mod_rewrite - Apache HTTP Server</title>
+<link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
+<link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
+<link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
+<link href="../images/favicon.ico" rel="shortcut icon" /></head>
+<body>
+<div id="page-header">
+<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>
+<p class="apache">Apache HTTP Server Version 2.1</p>
+<img alt="" src="../images/feather.gif" /></div>
+<div class="up"><a href="./"><img title="<-" alt="<-" src="../images/left.gif" /></a></div>
+<div id="path">
+<a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs-project/">Documentation</a> > <a href="../">Version 2.1</a> > <a href="./">Modules</a></div>
+<div id="page-content">
+<div id="preamble"><h1>Apache Module mod_rewrite</h1>
+<div class="toplang">
+<p><span>Available Languages: </span><a href="../en/mod/mod_rewrite.html" title="English"> en </a></p>
+</div>
+<table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Provides a rule-based rewriting engine to rewrite requested
+URLs on the fly</td></tr>
+<tr><th><a href="module-dict.html#Status">Status:</a></th><td>Extension</td></tr>
+<tr><th><a href="module-dict.html#ModuleIdentifier">Module Identifier:</a></th><td>rewrite_module</td></tr>
+<tr><th><a href="module-dict.html#SourceFile">Source File:</a></th><td>mod_rewrite.c</td></tr>
+<tr><th><a href="module-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 1.3 and later</td></tr></table>
+<h3>Summary</h3>
+
<blockquote>
<p>``The great thing about mod_rewrite is it gives you
all the configurability and flexibility of Sendmail.
<a href="mailto:rse@engelschall.com"><code>rse@engelschall.com</code></a><br />
<a href="http://www.engelschall.com/"><code>www.engelschall.com</code></a>
</p>
-</div><div id="quickview"><h3 class="directives">Directives</h3><ul id="toc"><li><img alt="" src="../images/down.gif" /> <a href="#rewritebase">RewriteBase</a></li><li><img alt="" src="../images/down.gif" /> <a href="#rewritecond">RewriteCond</a></li><li><img alt="" src="../images/down.gif" /> <a href="#rewriteengine">RewriteEngine</a></li><li><img alt="" src="../images/down.gif" /> <a href="#rewritelock">RewriteLock</a></li><li><img alt="" src="../images/down.gif" /> <a href="#rewritelog">RewriteLog</a></li><li><img alt="" src="../images/down.gif" /> <a href="#rewriteloglevel">RewriteLogLevel</a></li><li><img alt="" src="../images/down.gif" /> <a href="#rewritemap">RewriteMap</a></li><li><img alt="" src="../images/down.gif" /> <a href="#rewriteoptions">RewriteOptions</a></li><li><img alt="" src="../images/down.gif" /> <a href="#rewriterule">RewriteRule</a></li></ul><h3>Topics</h3><ul id="topics"><li><img alt="" src="../images/down.gif" /> <a href="#Internal">Interal Processing</a></li><li><img alt="" src="../images/down.gif" /> <a href="#EnvVar">Environment Variables</a></li><li><img alt="" src="../images/down.gif" /> <a href="#Solutions">Practical Solutions</a></li></ul></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="section"><h2><a name="Internal" id="Internal">Interal Processing</a></h2>
+</div>
+<div id="quickview"><h3 class="directives">Directives</h3>
+<ul id="toc">
+<li><img alt="" src="../images/down.gif" /> <a href="#rewritebase">RewriteBase</a></li>
+<li><img alt="" src="../images/down.gif" /> <a href="#rewritecond">RewriteCond</a></li>
+<li><img alt="" src="../images/down.gif" /> <a href="#rewriteengine">RewriteEngine</a></li>
+<li><img alt="" src="../images/down.gif" /> <a href="#rewritelock">RewriteLock</a></li>
+<li><img alt="" src="../images/down.gif" /> <a href="#rewritelog">RewriteLog</a></li>
+<li><img alt="" src="../images/down.gif" /> <a href="#rewriteloglevel">RewriteLogLevel</a></li>
+<li><img alt="" src="../images/down.gif" /> <a href="#rewritemap">RewriteMap</a></li>
+<li><img alt="" src="../images/down.gif" /> <a href="#rewriteoptions">RewriteOptions</a></li>
+<li><img alt="" src="../images/down.gif" /> <a href="#rewriterule">RewriteRule</a></li>
+</ul>
+<h3>Topics</h3>
+<ul id="topics">
+<li><img alt="" src="../images/down.gif" /> <a href="#Internal">Internal Processing</a></li>
+<li><img alt="" src="../images/down.gif" /> <a href="#EnvVar">Environment Variables</a></li>
+<li><img alt="" src="../images/down.gif" /> <a href="#Solutions">Practical Solutions</a></li>
+</ul></div>
+<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
+<div class="section">
+<h2><a name="Internal" id="Internal">Internal Processing</a></h2>
<p>The internal processing of this module is very complex but
needs to be explained once even to the average user to avoid
<code>%N</code> (see below). These are available for creating
the strings <em>Substitution</em> and <em>TestString</em>.
Figure 2 shows to which locations the back-references are
- transfered for expansion.</p>
+ transferred for expansion.</p>
<p class="figure">
<img src="../images/mod_rewrite_fig2.gif" width="381" height="179" alt="[Needs graphics capability to display]" /><br />
directives.</p>
-</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="section"><h2><a name="EnvVar" id="EnvVar">Environment Variables</a></h2>
+</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
+<div class="section">
+<h2><a name="EnvVar" id="EnvVar">Environment Variables</a></h2>
<p>This module keeps track of two additional (non-standard)
CGI/SSI environment variables named <code>SCRIPT_URL</code>
SCRIPT_URI=http://en1.engelschall.com/u/rse/
</pre></div>
-</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="section"><h2><a name="Solutions" id="Solutions">Practical Solutions</a></h2>
+</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
+<div class="section">
+<h2><a name="Solutions" id="Solutions">Practical Solutions</a></h2>
<p>We also have an <a href="../misc/rewriteguide.html">URL
Rewriting Guide</a> available, which provides a collection of
practical solutions for URL-based problems. There you can
find real-life rulesets and additional information about
mod_rewrite.</p>
-</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="RewriteBase" id="RewriteBase">RewriteBase</a> <a name="rewritebase" id="rewritebase">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:
- </a></th><td>Sets the base URL for per-directory rewrites</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
- </a></th><td>RewriteBase <em>URL-path</em></td></tr><tr><th><a href="directive-dict.html#Default">Default:
- </a></th><td><code>See usage for information.</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:
- </a></th><td>directory, .htaccess</td></tr><tr><th><a href="directive-dict.html#Override">Override:
- </a></th><td>FileInfo</td></tr><tr><th><a href="directive-dict.html#Status">Status:
- </a></th><td>Extension</td></tr><tr><th><a href="directive-dict.html#Module">Module:
- </a></th><td>mod_rewrite</td></tr></table>
+</div>
+<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
+<div class="directive-section"><h2><a name="RewriteBase" id="RewriteBase">RewriteBase</a> <a name="rewritebase" id="rewritebase">Directive</a></h2>
+<table class="directive">
+<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets the base URL for per-directory rewrites</td></tr>
+<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>RewriteBase <em>URL-path</em></code></td></tr>
+<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>See usage for information.</code></td></tr>
+<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
+<tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
+<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
+<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_rewrite</td></tr>
+</table>
<p>The <code class="directive">RewriteBase</code> directive explicitly
sets the base URL for per-directory rewrites. As you will see
below, <code class="directive"><a href="#rewriterule">RewriteRule</a></code>
implementation is correct.</p>
</div>
-</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="RewriteCond" id="RewriteCond">RewriteCond</a> <a name="rewritecond" id="rewritecond">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:
- </a></th><td>Defines a condition under which rewriting will take place
-</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
- </a></th><td> RewriteCond
- <em>TestString</em> <em>CondPattern</em></td></tr><tr><th><a href="directive-dict.html#Default">Default:
- </a></th><td><code>None</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:
- </a></th><td>server config, virtual host, directory, .htaccess</td></tr><tr><th><a href="directive-dict.html#Override">Override:
- </a></th><td>FileInfo</td></tr><tr><th><a href="directive-dict.html#Status">Status:
- </a></th><td>Extension</td></tr><tr><th><a href="directive-dict.html#Module">Module:
- </a></th><td>mod_rewrite</td></tr></table>
+
+</div>
+<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
+<div class="directive-section"><h2><a name="RewriteCond" id="RewriteCond">RewriteCond</a> <a name="rewritecond" id="rewritecond">Directive</a></h2>
+<table class="directive">
+<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Defines a condition under which rewriting will take place
+</td></tr>
+<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code> RewriteCond
+ <em>TestString</em> <em>CondPattern</em></code></td></tr>
+<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
+<tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
+<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
+<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_rewrite</td></tr>
+</table>
<p>The <code class="directive">RewriteCond</code> directive defines a
rule condition. Precede a <code class="directive"><a href="#rewriterule">RewriteRule</a></code> directive with one
or more <code class="directive">RewriteCond</code> directives. The following
from the following list:
<table>
+
<tr>
<th>HTTP headers:</th> <th>connection & request:</th> <th />
</tr>
<td>
REMOTE_ADDR<br />
REMOTE_HOST<br />
+ REMOTE_PORT<br />
REMOTE_USER<br />
REMOTE_IDENT<br />
REQUEST_METHOD<br />
REQUEST_URI<br />
REQUEST_FILENAME<br />
IS_SUBREQ<br />
+ HTTPS<br />
</td>
</tr>
</table>
<dd>The full local filesystem path to the file or
script matching the request.</dd>
+
+ <dt><code>HTTPS</code></dt>
+
+ <dd>Will contain the text "on" if the connection is
+ using SSL/TLS, or "off" otherwise. (This variable
+ can be safely used regardless of whether
+ <code class="module"><a href="../mod/mod_ssl.html">mod_ssl</a></code> is loaded).</dd>
+
</dl>
</div>
</li>
Apache structures and (if not found there) via
<code>getenv()</code> from the Apache server process.</li>
+ <li>There is the special format:
+ <code>%{SSL:variable}</code> where <em>variable</em> is the
+ name of an <a href="mod_ssl.html#envvars">SSL environment
+ variable</a>; this can be used whether or not
+ <code class="module"><a href="../mod/mod_ssl.html">mod_ssl</a></code> is loaded, but will always expand to
+ the empty string if it is not. Example:
+ <code>%{SSL:SSL_CIPHER_USEKEYSIZE}</code> may expand to
+ <code>128</code>.</li>
+
<li>There is the special format:
<code>%{HTTP:header}</code> where <em>header</em> can be
any HTTP MIME-header name. This is looked-up from the HTTP
<em>CondPattern</em>.</p>
<p><strong>Remember:</strong> <em>CondPattern</em> is a
- standard <em>Extended Regular Expression</em> with some
+ <em>perl compatible regular expression</em> with some
additions:</p>
<ol>
Treats the <em>TestString</em> as a pathname and tests
if it exists and is a symbolic link.</li>
+ <li>'<strong>-x</strong>' (has e<strong>x</strong>ecutable
+ permissions)<br />
+ Treats the <em>TestString</em> as a pathname and tests
+ if it exists and has execution permissions. These permissions
+ are determined depending on the underlying OS.</li>
+
<li>'<strong>-F</strong>' (is existing file via
subrequest)<br />
Checks if <em>TestString</em> is a valid file and
tables, <em>etc.</em> If you use any other browser you get
the standard homepage.</p>
-</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="RewriteEngine" id="RewriteEngine">RewriteEngine</a> <a name="rewriteengine" id="rewriteengine">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:
- </a></th><td>Enables or disables runtime rewriting engine</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
- </a></th><td>RewriteEngine on|off</td></tr><tr><th><a href="directive-dict.html#Default">Default:
- </a></th><td><code>RewriteEngine off</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:
- </a></th><td>server config, virtual host, directory, .htaccess</td></tr><tr><th><a href="directive-dict.html#Override">Override:
- </a></th><td>FileInfo</td></tr><tr><th><a href="directive-dict.html#Status">Status:
- </a></th><td>Extension</td></tr><tr><th><a href="directive-dict.html#Module">Module:
- </a></th><td>mod_rewrite</td></tr></table>
+
+</div>
+<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
+<div class="directive-section"><h2><a name="RewriteEngine" id="RewriteEngine">RewriteEngine</a> <a name="rewriteengine" id="rewriteengine">Directive</a></h2>
+<table class="directive">
+<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enables or disables runtime rewriting engine</td></tr>
+<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>RewriteEngine on|off</code></td></tr>
+<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>RewriteEngine off</code></td></tr>
+<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
+<tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
+<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
+<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_rewrite</td></tr>
+</table>
<p>The <code class="directive">RewriteEngine</code> directive enables or
disables the runtime rewriting engine. If it is set to
inherited. This means that you need to have a
<code>RewriteEngine on</code> directive for each virtual host
in which you wish to use it.</p>
-</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="RewriteLock" id="RewriteLock">RewriteLock</a> <a name="rewritelock" id="rewritelock">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:
- </a></th><td>Sets the name of the lock file used for RewriteMap
-synchronization</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
- </a></th><td>RewriteLock <em>file-path</em></td></tr><tr><th><a href="directive-dict.html#Default">Default:
- </a></th><td><code>None</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:
- </a></th><td>server config</td></tr><tr><th><a href="directive-dict.html#Status">Status:
- </a></th><td>Extension</td></tr><tr><th><a href="directive-dict.html#Module">Module:
- </a></th><td>mod_rewrite</td></tr></table>
+
+</div>
+<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
+<div class="directive-section"><h2><a name="RewriteLock" id="RewriteLock">RewriteLock</a> <a name="rewritelock" id="rewritelock">Directive</a></h2>
+<table class="directive">
+<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets the name of the lock file used for RewriteMap
+synchronization</td></tr>
+<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>RewriteLock <em>file-path</em></code></td></tr>
+<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config</td></tr>
+<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
+<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_rewrite</td></tr>
+</table>
<p>This directive sets the filename for a synchronization
lockfile which mod_rewrite needs to communicate with <code class="directive"><a href="#rewritemap">RewriteMap</a></code>
<em>programs</em>. Set this lockfile to a local path (not on a
NFS-mounted device) when you want to use a rewriting
map-program. It is not required for other types of rewriting
maps.</p>
-</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="RewriteLog" id="RewriteLog">RewriteLog</a> <a name="rewritelog" id="rewritelog">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:
- </a></th><td>Sets the name of the file used for logging rewrite engine
-processing</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
- </a></th><td>RewriteLog <em>file-path</em></td></tr><tr><th><a href="directive-dict.html#Context">Context:
- </a></th><td>server config, virtual host</td></tr><tr><th><a href="directive-dict.html#Status">Status:
- </a></th><td>Extension</td></tr><tr><th><a href="directive-dict.html#Module">Module:
- </a></th><td>mod_rewrite</td></tr></table>
+
+</div>
+<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
+<div class="directive-section"><h2><a name="RewriteLog" id="RewriteLog">RewriteLog</a> <a name="rewritelog" id="rewritelog">Directive</a></h2>
+<table class="directive">
+<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets the name of the file used for logging rewrite engine
+processing</td></tr>
+<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>RewriteLog <em>file-path</em></code></td></tr>
+<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
+<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
+<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_rewrite</td></tr>
+</table>
<p>The <code class="directive">RewriteLog</code> directive sets the name
of the file to which the server logs any rewriting actions it
performs. If the name does not begin with a slash
RewriteLog "/usr/local/var/apache/logs/rewrite.log"
</code></p></div>
-</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="RewriteLogLevel" id="RewriteLogLevel">RewriteLogLevel</a> <a name="rewriteloglevel" id="rewriteloglevel">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:
- </a></th><td>Sets the verbosity of the log file used by the rewrite
-engine</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
- </a></th><td>RewriteLogLevel <em>Level</em></td></tr><tr><th><a href="directive-dict.html#Default">Default:
- </a></th><td><code>RerwiteLogLevel 0</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:
- </a></th><td>server config, virtual host</td></tr><tr><th><a href="directive-dict.html#Status">Status:
- </a></th><td>Extension</td></tr><tr><th><a href="directive-dict.html#Module">Module:
- </a></th><td>mod_rewrite</td></tr></table>
+
+</div>
+<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
+<div class="directive-section"><h2><a name="RewriteLogLevel" id="RewriteLogLevel">RewriteLogLevel</a> <a name="rewriteloglevel" id="rewriteloglevel">Directive</a></h2>
+<table class="directive">
+<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets the verbosity of the log file used by the rewrite
+engine</td></tr>
+<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>RewriteLogLevel <em>Level</em></code></td></tr>
+<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>RewriteLogLevel 0</code></td></tr>
+<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
+<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
+<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_rewrite</td></tr>
+</table>
<p>The <code class="directive">RewriteLogLevel</code> directive sets the
verbosity level of the rewriting logfile. The default level 0
means no logging, while 9 or more means that practically all
RewriteLogLevel 3
</code></p></div>
-</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="RewriteMap" id="RewriteMap">RewriteMap</a> <a name="rewritemap" id="rewritemap">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:
- </a></th><td>Defines a mapping function for key-lookup</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
- </a></th><td>RewriteMap <em>MapName</em> <em>MapType</em>:<em>MapSource</em>
-</td></tr><tr><th><a href="directive-dict.html#Default">Default:
- </a></th><td><code>None</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:
- </a></th><td>server config, virtual host</td></tr><tr><th><a href="directive-dict.html#Status">Status:
- </a></th><td>Extension</td></tr><tr><th><a href="directive-dict.html#Module">Module:
- </a></th><td>mod_rewrite</td></tr></table>
+
+</div>
+<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
+<div class="directive-section"><h2><a name="RewriteMap" id="RewriteMap">RewriteMap</a> <a name="rewritemap" id="rewritemap">Directive</a></h2>
+<table class="directive">
+<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Defines a mapping function for key-lookup</td></tr>
+<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>RewriteMap <em>MapName</em> <em>MapType</em>:<em>MapSource</em>
+</code></td></tr>
+<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
+<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
+<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_rewrite</td></tr>
+<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>The choice of different dbm types is available in
+Apache 2.0.41 and later</td></tr>
+</table>
<p>The <code class="directive">RewriteMap</code> directive defines a
<em>Rewriting Map</em> which can be used inside rule
substitution strings by the mapping-functions to
in a special representation which is optimized for really
fast lookups. The <em>type</em> can be sdbm, gdbm, ndbm, or
db depending on <a href="../install.html#dbm">compile-time
- settings</a>. If the <em>type</em> is ommitted, the
+ settings</a>. If the <em>type</em> is omitted, the
compile-time default will be chosen. You can create such a
file with any DBM tool or with the following Perl
script. Be sure to adjust it to create the appropriate
once!
</div>
-</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="RewriteOptions" id="RewriteOptions">RewriteOptions</a> <a name="rewriteoptions" id="rewriteoptions">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:
- </a></th><td>Sets some special options for the rewrite engine</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
- </a></th><td>RewriteOptions <em>Options</em></td></tr><tr><th><a href="directive-dict.html#Default">Default:
- </a></th><td><code>None</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:
- </a></th><td>server config, virtual host, directory, .htaccess</td></tr><tr><th><a href="directive-dict.html#Status">Status:
- </a></th><td>Extension</td></tr><tr><th><a href="directive-dict.html#Module">Module:
- </a></th><td>mod_rewrite</td></tr></table>
+
+</div>
+<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
+<div class="directive-section"><h2><a name="RewriteOptions" id="RewriteOptions">RewriteOptions</a> <a name="rewriteoptions" id="rewriteoptions">Directive</a></h2>
+<table class="directive">
+<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets some special options for the rewrite engine</td></tr>
+<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>RewriteOptions <var>Options</var></code></td></tr>
+<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
+<tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
+<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
+<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_rewrite</td></tr>
+<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td><code>MaxRedirects</code> is no longer available in version 2.1 and
+later</td></tr>
+</table>
<p>The <code class="directive">RewriteOptions</code> directive sets some
special options for the current per-server or per-directory
- configuration. The <em>Option</em> strings can be one of the
- following:</p>
+ configuration. The <em>Option</em> string can be currently only one:</p>
+
+ <dl>
+ <dt><code>inherit</code></dt>
+ <dd>This forces the current configuration to inherit the
+ configuration of the parent. In per-virtual-server context
+ this means that the maps, conditions and rules of the main
+ server are inherited. In per-directory context this means
+ that conditions and rules of the parent directory's
+ <code>.htaccess</code> configuration are inherited.</dd>
+ </dl>
- <ul>
- <li>'<strong><code>inherit</code></strong>'<br />
- This forces the current configuration to inherit the
- configuration of the parent. In per-virtual-server context
- this means that the maps, conditions and rules of the main
- server are inherited. In per-directory context this means
- that conditions and rules of the parent directory's
- <code>.htaccess</code> configuration are inherited.</li>
- </ul>
-</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="RewriteRule" id="RewriteRule">RewriteRule</a> <a name="rewriterule" id="rewriterule">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:
- </a></th><td>Defines rules for the rewriting engine</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:
- </a></th><td>RewriteRule
- <em>Pattern</em> <em>Substitution</em></td></tr><tr><th><a href="directive-dict.html#Default">Default:
- </a></th><td><code>None</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:
- </a></th><td>server config, virtual host, directory, .htaccess</td></tr><tr><th><a href="directive-dict.html#Override">Override:
- </a></th><td>FileInfo</td></tr><tr><th><a href="directive-dict.html#Status">Status:
- </a></th><td>Extension</td></tr><tr><th><a href="directive-dict.html#Module">Module:
- </a></th><td>mod_rewrite</td></tr></table>
+</div>
+<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
+<div class="directive-section"><h2><a name="RewriteRule" id="RewriteRule">RewriteRule</a> <a name="rewriterule" id="rewriterule">Directive</a></h2>
+<table class="directive">
+<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Defines rules for the rewriting engine</td></tr>
+<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>RewriteRule
+ <em>Pattern</em> <em>Substitution</em></code></td></tr>
+<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
+<tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
+<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
+<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_rewrite</td></tr>
+<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>The cookie-flag is available in Apache 2.0.40 and later.</td></tr>
+</table>
<p>The <code class="directive">RewriteRule</code> directive is the real
rewriting workhorse. The directive can occur more than once.
Each directive then defines one single rewriting rule. The
<strong>important</strong>, because this order is used when
applying the rules at run-time.</p>
- <p><a id="patterns" name="patterns"><em>Pattern</em></a> can
- be (for Apache 1.1.x a System V8 and for Apache 1.2.x and
- later a POSIX) <a id="regexp" name="regexp">regular
+ <p><a id="patterns" name="patterns"><em>Pattern</em></a> is
+ a perl compatible <a id="regexp" name="regexp">regular
expression</a> which gets applied to the current URL. Here
``current'' means the value of the URL when this rule gets
applied. This may not be the originally requested URL,
(for instance to specify the chars "<code>.[]()</code>" <em>etc.</em>)
</pre></div>
- <p>For more information about regular expressions either have
- a look at your local regex(3) manpage or its
- <code>src/regex/regex.3</code> copy in the Apache 1.3
- distribution. If you are interested in more detailed
+ <p>For more information about regular expressions have a look at the
+ perl regular expression manpage ("<a href="http://www.perldoc.com/perl5.6.1/pod/perlre.html">perldoc
+ perlre</a>"). If you are interested in more detailed
information about regular expressions and their variants
- (POSIX regex, Perl regex, <em>etc.</em>) have a look at the
+ (POSIX regex <em>etc.</em>) have a look at the
following dedicated book on this topic:</p>
<p class="indent">
able to have more than one pattern to be applied before a
substitution occurs.</p>
- <p>One more note: You can even create URLs in the
- substitution string containing a query string part. Just use
- a question mark inside the substitution string to indicate
- that the following stuff should be re-injected into the
- QUERY_STRING. When you want to erase an existing query
- string, end the substitution string with just the question
- mark.</p>
+<div class="note"><h3>Query String</h3>
+ <p>The <em>Pattern</em> will not match against the query string.
+ Instead, you must use a <code class="directive"><a href="#rewritecond">RewriteCond</a></code> with the
+ <code>%{QUERY_STRING}</code> variable. You can, however, create
+ URLs in the substitution string containing a query string
+ part. Just use a question mark inside the substitution string to
+ indicate that the following stuff should be re-injected into the
+ query string. When you want to erase an existing query string,
+ end the substitution string with just the question mark. To
+ combine a new query string with an old one, use the
+ <code>[QSA]</code> flag (see below).</p>
+</div>
-<div class="note"><h3>Note</h3>
-There is a special feature:
+<div class="note"><h3>Substitution of Absolute URLs</h3>
+ <p>There is a special feature:
When you prefix a substitution field with
<code>http://</code><em>thishost</em>[<em>:thisport</em>]
then <strong>mod_rewrite</strong> automatically strips it
URLs is a useful and important feature when used in
combination with a mapping-function which generates the
hostname part. Have a look at the first example in the
- example section below to understand this.
-</div>
+ example section below to understand this.</p>
-<div class="note"><h3>Remember</h3>
- An unconditional external
+ <p><strong>Remember:</strong> An unconditional external
redirect to your own server will not work with the prefix
<code>http://thishost</code> because of this feature. To
achieve such a self-redirect, you have to use the
- <strong>R</strong>-flag (see below).
+ <strong>R</strong>-flag (see below).</p>
</div>
<p>Additionally you can set special flags for
<code>mod_proxy.c</code> is part of the ``<code>httpd
-l</code>'' output. If yes, this functionality is
available to mod_rewrite. If not, then you first have to
- rebuild the ``<code>httpd</code>'' program with mod_proxy
+ rebuild the <code class="program"><a href="../programs/httpd.html">httpd</a></code> program with mod_proxy
enabled.</p>
</li>
(force MIME <strong>t</strong>ype)<br />
Force the MIME-type of the target file to be
<em>MIME-type</em>. For instance, this can be used to
+ setup the content-type based on some conditions.
+ For example, the following snippet allows <code>.php</code> files to
+ be <em>displayed</em> by <code>mod_php</code> if they are called with
+ the <code>.phps</code> extension:
+ <div class="example"><p><code>
+ RewriteRule ^(.+\.php)s$ $1 [T=application/x-httpd-php-source]
+ </code></p></div>
+ </li>
+
+ <li>
+ '<strong><code>handler|H</code></strong>=<em>Content-handler</em>'
+ (force Content <strong>h</strong>andler)<br />
+ Force the Content-handler of the target file to be
+ <em>Content-handler</em>. For instance, this can be used to
simulate the <code>mod_alias</code> directive
<code>ScriptAlias</code> which internally forces all files
- inside the mapped directory to have a MIME type of
- ``<code>application/x-httpd-cgi</code>''.</li>
+ inside the mapped directory to have a handler of
+ ``<code>cgi-script</code>''.</li>
<li>
'<strong><code>nosubreq|NS</code></strong>' (used only if
URL-to-filename translators</strong>. The typical example
is the use of <code>mod_alias</code> and
<code>mod_rewrite</code>..</p>
-
-<div class="note"><h3>For Apache hackers</h3>
- If the current Apache API had a filename-to-filename
- hook additionally to the URI-to-filename hook then we
- wouldn't need this flag! But without such a hook this
- flag is the only solution. The Apache Group has
- discussed this problem and will add such a hook in
- Apache version 2.0.
-</div>
</li>
<li>'<strong><code>skip|S</code></strong>=<em>num</em>'
<li>
'<strong><code>cookie|CO=</code></strong><em>NAME</em>:<em>VAL</em>:<em>domain</em>[:<em>lifetime</em>[:<em>path</em>]]'
- (set <strong>co</strong>cookie)<br />
+ (set <strong>co</strong>okie)<br />
This sets a cookie on the client's browser. The cookie's name
is specified by <em>NAME</em> and the value is
<em>VAL</em>. The <em>domain</em> field is the domain of the
RewriteMap real-to-user txt:/path/to/file/map.txt
RewriteRule ^/([^/]+)/~([^/]+)/(.*)$ /u/${real-to-user:$2|nobody}/$3.$1
</pre></div>
- </div></div><div id="footer"><p class="apache">Maintained by the <a href="http://httpd.apache.org/docs-project/">Apache HTTP Server Documentation Project</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>
\ No newline at end of file
+
+</div>
+</div>
+<div class="bottomlang">
+<p><span>Available Languages: </span><a href="../en/mod/mod_rewrite.html" title="English"> en </a></p>
+</div><div id="footer">
+<p class="apache">Copyright 1999-2004 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>
\ No newline at end of file