mod_rewrite.html.en revision be43e9e06cd92267cbc1476ed1655265a20a2a28
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
a7835c7a8cf86045fdaee65dc2839bfe6314fb1end<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
db878466c5e95073429dda0bdd001f45e9486e16fielding XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
db878466c5e95073429dda0bdd001f45e9486e16fielding This file is generated from xml source: DO NOT EDIT
db878466c5e95073429dda0bdd001f45e9486e16fielding XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
db878466c5e95073429dda0bdd001f45e9486e16fielding<link href="/style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
a7835c7a8cf86045fdaee65dc2839bfe6314fb1end<link href="/style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
a7835c7a8cf86045fdaee65dc2839bfe6314fb1end<link href="/style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
a7835c7a8cf86045fdaee65dc2839bfe6314fb1end<link href="/images/favicon.ico" rel="shortcut icon" /></head>
a7835c7a8cf86045fdaee65dc2839bfe6314fb1end<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>
a7835c7a8cf86045fdaee65dc2839bfe6314fb1end<div class="up"><a href="./"><img title="<-" alt="<-" src="/images/left.gif" /></a></div>
117a9c5156c08125e2060ff892adac4634b7ad2dnd<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>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<p><span>Available Languages: </span><a href="/en/mod/mod_rewrite.html" title="English"> en </a></p>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Provides a rule-based rewriting engine to rewrite requested
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<tr><th><a href="module-dict.html#Status">Status:</a></th><td>Extension</td></tr>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<tr><th><a href="module-dict.html#ModuleIdentifier">Module�Identifier:</a></th><td>rewrite_module</td></tr>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<tr><th><a href="module-dict.html#SourceFile">Source�File:</a></th><td>mod_rewrite.c</td></tr>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<tr><th><a href="module-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 1.3 and later</td></tr></table>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive <blockquote>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive <p>``The great thing about mod_rewrite is it gives you
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive all the configurability and flexibility of Sendmail.
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive The downside to mod_rewrite is that it gives you all
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive the configurability and flexibility of Sendmail.''</p>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive <p class="cite">-- <cite>Brian Behlendorf</cite><br />
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive Apache Group</p>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive </blockquote>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive <blockquote>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive <p>`` Despite the tons of examples and docs,
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive mod_rewrite is voodoo. Damned cool voodoo, but still
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive voodoo. ''</p>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive bem@news.cmc.net</p>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive </blockquote>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive <p>Welcome to mod_rewrite, the Swiss Army Knife of URL
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive manipulation!</p>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive <p>This module uses a rule-based rewriting engine (based on a
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive regular-expression parser) to rewrite requested URLs on the
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive fly. It supports an unlimited number of rules and an
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive unlimited number of attached rule conditions for each rule to
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive provide a really flexible and powerful URL manipulation
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive mechanism. The URL manipulations can depend on various tests,
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive for instance server variables, environment variables, HTTP
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive headers, time stamps and even external database lookups in
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive various formats can be used to achieve a really granular URL
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive matching.</p>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive <p>This module operates on the full URLs (including the
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive path-info part) both in per-server context
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive (<code>.htaccess</code>) and can even generate query-string
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive parts on result. The rewritten result can lead to internal
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive sub-processing, external request redirection or even to an
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive internal proxy throughput.</p>
1cb160a981947e75a8353da3fe40a653aa87100eslive <p>But all this functionality and flexibility has its
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive drawback: complexity. So don't expect to understand this
46d1ef8cb385aa2f519ce7d355afc51f144bd938slive entire module in just one day.</p>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive <p>This module was invented and originally written in April
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive 1996 and gifted exclusively to the The Apache Group in July 1997
46d1ef8cb385aa2f519ce7d355afc51f144bd938slive <a href="mailto:rse@engelschall.com"><code>rse@engelschall.com</code></a><br />
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive <a href="http://www.engelschall.com/"><code>www.engelschall.com</code></a>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<div id="quickview"><h3 class="directives">Directives</h3>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<li><img alt="" src="/images/down.gif" /> <a href="#rewritebase">RewriteBase</a></li>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<li><img alt="" src="/images/down.gif" /> <a href="#rewritecond">RewriteCond</a></li>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<li><img alt="" src="/images/down.gif" /> <a href="#rewriteengine">RewriteEngine</a></li>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<li><img alt="" src="/images/down.gif" /> <a href="#rewritelock">RewriteLock</a></li>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<li><img alt="" src="/images/down.gif" /> <a href="#rewritelog">RewriteLog</a></li>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<li><img alt="" src="/images/down.gif" /> <a href="#rewriteloglevel">RewriteLogLevel</a></li>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<li><img alt="" src="/images/down.gif" /> <a href="#rewritemap">RewriteMap</a></li>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<li><img alt="" src="/images/down.gif" /> <a href="#rewriteoptions">RewriteOptions</a></li>
5e9423b4ca454c6416a2dc465dea1b1d34cec7a9slive<li><img alt="" src="/images/down.gif" /> <a href="#rewriterule">RewriteRule</a></li>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<li><img alt="" src="/images/down.gif" /> <a href="#Internal">Internal Processing</a></li>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<li><img alt="" src="/images/down.gif" /> <a href="#EnvVar">Environment Variables</a></li>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<li><img alt="" src="/images/down.gif" /> <a href="#Solutions">Practical Solutions</a></li>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
46d1ef8cb385aa2f519ce7d355afc51f144bd938slive<h2><a name="Internal" id="Internal">Internal Processing</a></h2>
1c6a10274e908898347be82bc82bc7ae18c66410slive <p>The internal processing of this module is very complex but
1c6a10274e908898347be82bc82bc7ae18c66410slive needs to be explained once even to the average user to avoid
1c6a10274e908898347be82bc82bc7ae18c66410slive common mistakes and to let you exploit its full
1c6a10274e908898347be82bc82bc7ae18c66410slive functionality.</p>
1c6a10274e908898347be82bc82bc7ae18c66410slive<h3><a name="InternalAPI" id="InternalAPI">API Phases</a></h3>
1c6a10274e908898347be82bc82bc7ae18c66410slive <p>First you have to understand that when Apache processes a
1c6a10274e908898347be82bc82bc7ae18c66410slive HTTP request it does this in phases. A hook for each of these
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive phases is provided by the Apache API. Mod_rewrite uses two of
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive these hooks: the URL-to-filename translation hook which is
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive used after the HTTP request has been read but before any
46d1ef8cb385aa2f519ce7d355afc51f144bd938slive authorization starts and the Fixup hook which is triggered
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive after the authorization phases and after the per-directory
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive config files (<code>.htaccess</code>) have been read, but
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive before the content handler is activated.</p>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive <p>So, after a request comes in and Apache has determined the
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive corresponding server (or virtual server) the rewriting engine
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive starts processing of all mod_rewrite directives from the
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive per-server configuration in the URL-to-filename phase. A few
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive steps later when the final data directories are found, the
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive per-directory configuration directives of mod_rewrite are
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive triggered in the Fixup phase. In both situations mod_rewrite
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive rewrites URLs either to new URLs or to filenames, although
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive there is no obvious distinction between them. This is a usage
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive of the API which was not intended to be this way when the API
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive was designed, but as of Apache 1.x this is the only way
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive mod_rewrite can operate. To make this point more clear
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive remember the following two points:</p>
01979b991e320f79fe2c1ae2afc298e8651bd69aslive <li>Although mod_rewrite rewrites URLs to URLs, URLs to
01979b991e320f79fe2c1ae2afc298e8651bd69aslive filenames and even filenames to filenames, the API
01979b991e320f79fe2c1ae2afc298e8651bd69aslive currently provides only a URL-to-filename hook. In Apache
01979b991e320f79fe2c1ae2afc298e8651bd69aslive 2.0 the two missing hooks will be added to make the
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive processing more clear. But this point has no drawbacks for
01979b991e320f79fe2c1ae2afc298e8651bd69aslive the user, it is just a fact which should be remembered:
01979b991e320f79fe2c1ae2afc298e8651bd69aslive Apache does more in the URL-to-filename hook than the API
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive intends for it.</li>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive Unbelievably mod_rewrite provides URL manipulations in
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive <code>.htaccess</code> files, although these are reached
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive a very long time after the URLs have been translated to
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive filenames. It has to be this way because
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive <code>.htaccess</code> files live in the filesystem, so
01979b991e320f79fe2c1ae2afc298e8651bd69aslive processing has already reached this stage. In other
01979b991e320f79fe2c1ae2afc298e8651bd69aslive words: According to the API phases at this time it is too
01979b991e320f79fe2c1ae2afc298e8651bd69aslive late for any URL manipulations. To overcome this chicken
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive and egg problem mod_rewrite uses a trick: When you
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive mod_rewrite first rewrites the filename back to its
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive corresponding URL (which is usually impossible, but see
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive trick to achieve this) and then initiates a new internal
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive sub-request with the new URL. This restarts processing of
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive the API phases.
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive <p>Again mod_rewrite tries hard to make this complicated
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive step totally transparent to the user, but you should
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive remember here: While URL manipulations in per-server
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive context are really fast and efficient, per-directory
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive rewrites are slow and inefficient due to this chicken and
368bcafaedaee463f769c1b5f3547b9970df90d0slive egg problem. But on the other hand this is the only way
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive mod_rewrite can provide (locally restricted) URL
b3137f48abe3090c5531392e57ff0fefd76f59ebnd manipulations to the average user.</p>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive<h3><a name="InternalRuleset" id="InternalRuleset">Ruleset Processing</a></h3>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive <p>Now when mod_rewrite is triggered in these two API phases, it
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive reads the configured rulesets from its configuration
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive structure (which itself was either created on startup for
b3137f48abe3090c5531392e57ff0fefd76f59ebnd per-server context or during the directory walk of the Apache
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive kernel for per-directory context). Then the URL rewriting
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive engine is started with the contained ruleset (one or more
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive rules together with their conditions). The operation of the
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive URL rewriting engine itself is exactly the same for both
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive configuration contexts. Only the final result processing is
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive different. </p>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive <p>The order of rules in the ruleset is important because the
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive rewriting engine processes them in a special (and not very
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive obvious) order. The rule is this: The rewriting engine loops
46d1ef8cb385aa2f519ce7d355afc51f144bd938slive through the ruleset rule by rule (<code class="directive"><a href="#rewriterule">RewriteRule</a></code> directives) and
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive when a particular rule matches it optionally loops through
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive existing corresponding conditions (<code>RewriteCond</code>
3fa58e00171aebf3b2cfa90035ed530f5b1f651dslive directives). For historical reasons the conditions are given
1cb160a981947e75a8353da3fe40a653aa87100eslive first, and so the control flow is a little bit long-winded. See
1cb160a981947e75a8353da3fe40a653aa87100eslive Figure 1 for more details.</p>
1cb160a981947e75a8353da3fe40a653aa87100eslive <img src="/images/mod_rewrite_fig1.gif" width="428" height="385" alt="[Needs graphics capability to display]" /><br />
1cb160a981947e75a8353da3fe40a653aa87100eslive <dfn>Figure 1:</dfn>The control flow through the rewriting ruleset
1cb160a981947e75a8353da3fe40a653aa87100eslive <p>As you can see, first the URL is matched against the
1cb160a981947e75a8353da3fe40a653aa87100eslive immediately stops processing this rule and continues with the
1cb160a981947e75a8353da3fe40a653aa87100eslive next rule. If the <em>Pattern</em> matches, mod_rewrite looks
1cb160a981947e75a8353da3fe40a653aa87100eslive for corresponding rule conditions. If none are present, it
1cb160a981947e75a8353da3fe40a653aa87100eslive just substitutes the URL with a new value which is
1cb160a981947e75a8353da3fe40a653aa87100eslive constructed from the string <em>Substitution</em> and goes on
1cb160a981947e75a8353da3fe40a653aa87100eslive with its rule-looping. But if conditions exist, it starts an
1cb160a981947e75a8353da3fe40a653aa87100eslive inner loop for processing them in the order that they are
1cb160a981947e75a8353da3fe40a653aa87100eslive listed. For conditions the logic is different: we don't match
1cb160a981947e75a8353da3fe40a653aa87100eslive a pattern against the current URL. Instead we first create a
1cb160a981947e75a8353da3fe40a653aa87100eslive back-references, map lookups, <em>etc.</em> and then we try
1cb160a981947e75a8353da3fe40a653aa87100eslive to match <em>CondPattern</em> against it. If the pattern
1cb160a981947e75a8353da3fe40a653aa87100eslive doesn't match, the complete set of conditions and the
1cb160a981947e75a8353da3fe40a653aa87100eslive corresponding rule fails. If the pattern matches, then the
1cb160a981947e75a8353da3fe40a653aa87100eslive next condition is processed until no more conditions are
1cb160a981947e75a8353da3fe40a653aa87100eslive available. If all conditions match, processing is continued
1cb160a981947e75a8353da3fe40a653aa87100eslive with the substitution of the URL with
1cb160a981947e75a8353da3fe40a653aa87100eslive<h3><a name="quoting" id="quoting">Quoting Special Characters</a></h3>
1cb160a981947e75a8353da3fe40a653aa87100eslive <p>As of Apache 1.3.20, special characters in
1cb160a981947e75a8353da3fe40a653aa87100eslive <em>TestString</em> and <em>Substitution</em> strings can be
1cb160a981947e75a8353da3fe40a653aa87100eslive escaped (that is, treated as normal characters without their
1cb160a981947e75a8353da3fe40a653aa87100eslive usual special meaning) by prefixing them with a slosh ('\')
1cb160a981947e75a8353da3fe40a653aa87100eslive character. In other words, you can include an actual
<img src="/images/mod_rewrite_fig2.gif" width="381" height="179" alt="[Needs graphics capability to display]" /><br />
SCRIPT_URI=http://en1.engelschall.com/u/rse/
<div class="directive-section"><h2><a name="RewriteBase" id="RewriteBase">RewriteBase</a> <a name="rewritebase" id="rewritebase">Directive</a></h2>
<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>
path. The default setting is; <code class="directive">RewriteBase</code> <em>physical-directory-path</em></p>
files where you want to use <code class="directive"><a href="#rewriterule">RewriteRule</a></code> directives.
RewriteRule ^oldstuff\.html$ newstuff.html
<div class="directive-section"><h2><a name="RewriteCond" id="RewriteCond">RewriteCond</a> <a name="rewritecond" id="rewritecond">Directive</a></h2>
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Defines a condition under which rewriting will take place
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
rule condition. Precede a <code class="directive"><a href="#rewriterule">RewriteRule</a></code> directive with one
RewriteRule ...some special stuff for any of these hosts...
RewriteRule ^/$ /homepage.max.html [L]
RewriteRule ^/$ /homepage.min.html [L]
RewriteRule ^/$ /homepage.std.html [L]
<div class="directive-section"><h2><a name="RewriteEngine" id="RewriteEngine">RewriteEngine</a> <a name="rewriteengine" id="rewriteengine">Directive</a></h2>
<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>
commenting out all the <code class="directive"><a href="#rewriterule">RewriteRule</a></code> directives!</p>
<div class="directive-section"><h2><a name="RewriteLock" id="RewriteLock">RewriteLock</a> <a name="rewritelock" id="rewritelock">Directive</a></h2>
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets the name of the lock file used for RewriteMap
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>RewriteLock <em>file-path</em></code></td></tr>
lockfile which mod_rewrite needs to communicate with <code class="directive"><a href="#rewritemap">RewriteMap</a></code>
<div class="directive-section"><h2><a name="RewriteLog" id="RewriteLog">RewriteLog</a> <a name="rewritelog" id="rewritelog">Directive</a></h2>
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets the name of the file used for logging rewrite engine
<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>
<div class="directive-section"><h2><a name="RewriteLogLevel" id="RewriteLogLevel">RewriteLogLevel</a> <a name="rewriteloglevel" id="rewriteloglevel">Directive</a></h2>
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets the verbosity of the log file used by the rewrite
<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>
<div class="directive-section"><h2><a name="RewriteMap" id="RewriteMap">RewriteMap</a> <a name="rewritemap" id="rewritemap">Directive</a></h2>
<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>
<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#Compatibility">Compatibility:</a></th><td>The choice of different dbm types is available in
## map.txt -- rewriting map
Ralf.S.Engelschall rse # Bastard Operator From Hell
Mr.Joe.Average joe # Mr. Average
## map.txt -- rewriting map
# ...put here any transformations or lookups...
<div class="directive-section"><h2><a name="RewriteOptions" id="RewriteOptions">RewriteOptions</a> <a name="rewriteoptions" id="rewriteoptions">Directive</a></h2>
<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#Default">Default:</a></th><td><code>RewriteOptions MaxRedirects=10</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#Compatibility">Compatibility:</a></th><td><code>MaxRedirects</code> is available in Apache 2.0.45 and
issued by per-directory <code class="directive"><a href="#rewriterule">RewriteRule</a></code>s, <code class="module"><a href="/mod/mod_rewrite.html">mod_rewrite</a></code> aborts
<div class="directive-section"><h2><a name="RewriteRule" id="RewriteRule">RewriteRule</a> <a name="rewriterule" id="rewriterule">Directive</a></h2>
<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#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</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>
perl regular expression manpage ("<a href="http://www.perldoc.com/perl5.6.1/pod/perlre.html">perldoc
[=<em>code</em>]</strong>' (force <a id="redirect" name="redirect"><strong>r</strong>edirect</a>)<br />
rewriting rule processing stops here) put through the <a href="mod_proxy.html">proxy module</a>. You have to make
'<strong><code>cookie|CO=</code></strong><em>NAME</em>:<em>VAL</em>:<em>domain</em>[:<em>lifetime</em>[:<em>path</em>]]'
^/somepath(.*) /otherpath$1 [R] http://thishost/otherpath/pathinfo
^/somepath(.*) http://thishost/otherpath$1 [P] not supported, because silly!
^localpath(.*) otherpath$1 [R] http://thishost/somepath/otherpath/pathinfo
^localpath(.*) /otherpath$1 [R] http://thishost/otherpath/pathinfo
^localpath(.*) http://thishost/otherpath$1 [P] not supported, because silly!
<p><span>Available Languages: </span><a href="/en/mod/mod_rewrite.html" title="English"> en </a></p>
<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>