mod_rewrite.html.en revision 4988bb943ad0c9b851eae6a2e5d9a59529630b96
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick This file is generated from xml source: DO NOT EDIT
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick<link href="/style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick<link href="/style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick<link href="/style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick<link href="/images/favicon.ico" rel="shortcut icon" /></head>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick<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>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick<div class="up"><a href="./"><img title="<-" alt="<-" src="/images/left.gif" /></a></div>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick<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.5</a> > <a href="./">Modules</a></div>
182d9b96e04124d14c9f539109fb4e8cbd360d36trawick<div id="preamble"><h1>Apache Module mod_rewrite</h1>
182d9b96e04124d14c9f539109fb4e8cbd360d36trawick<p><span>Available Languages: </span><a href="/en/mod/mod_rewrite.html" title="English"> en </a> |
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick<a href="/fr/mod/mod_rewrite.html" hreflang="fr" rel="alternate" title="Fran�ais"> fr </a></p>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick<table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Provides a rule-based rewriting engine to rewrite requested
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick<tr><th><a href="module-dict.html#Status">Status:</a></th><td>Extension</td></tr>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick<tr><th><a href="module-dict.html#ModuleIdentifier">Module�Identifier:</a></th><td>rewrite_module</td></tr>
182d9b96e04124d14c9f539109fb4e8cbd360d36trawick<tr><th><a href="module-dict.html#SourceFile">Source�File:</a></th><td>mod_rewrite.c</td></tr></table>
182d9b96e04124d14c9f539109fb4e8cbd360d36trawick <p>The <code class="module"><a href="/mod/mod_rewrite.html">mod_rewrite</a></code> module uses a rule-based rewriting
182d9b96e04124d14c9f539109fb4e8cbd360d36trawick engine, based on a regular-expression parser, to rewrite requested URLs on
182d9b96e04124d14c9f539109fb4e8cbd360d36trawick the fly. By default, <code class="module"><a href="/mod/mod_rewrite.html">mod_rewrite</a></code> maps a URL to a filesystem
182d9b96e04124d14c9f539109fb4e8cbd360d36trawick path. However, it can also be used to redirect one URL to another URL, or
182d9b96e04124d14c9f539109fb4e8cbd360d36trawick to invoke an internal proxy fetch.</p>
182d9b96e04124d14c9f539109fb4e8cbd360d36trawick <p><code class="module"><a href="/mod/mod_rewrite.html">mod_rewrite</a></code> provides a flexible and powerful way to
182d9b96e04124d14c9f539109fb4e8cbd360d36trawick manipulate URLs using an unlimited number of rules. Each rule can have an
182d9b96e04124d14c9f539109fb4e8cbd360d36trawick unlimited number of attached rule conditions, to allow you to rewrite URL
182d9b96e04124d14c9f539109fb4e8cbd360d36trawick based on server variables, environment variables, HTTP headers, or time
182d9b96e04124d14c9f539109fb4e8cbd360d36trawick stamps.</p>
182d9b96e04124d14c9f539109fb4e8cbd360d36trawick <p><code class="module"><a href="/mod/mod_rewrite.html">mod_rewrite</a></code> operates on the full URL path, including the
182d9b96e04124d14c9f539109fb4e8cbd360d36trawick path-info section. A rewrite rule can be invoked in
182d9b96e04124d14c9f539109fb4e8cbd360d36trawick <code>httpd.conf</code> or in <code>.htaccess</code>. The path generated
182d9b96e04124d14c9f539109fb4e8cbd360d36trawick by a rewrite rule can include a query string, or can lead to internal
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick sub-processing, external request redirection, or internal proxy
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick throughput.</p>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <p>Further details, discussion, and examples, are provided in the
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <a href="/rewrite/">detailed mod_rewrite documentation</a>.</p>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick<div id="quickview"><h3 class="directives">Directives</h3>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick<li><img alt="" src="/images/down.gif" /> <a href="#rewritebase">RewriteBase</a></li>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick<li><img alt="" src="/images/down.gif" /> <a href="#rewritecond">RewriteCond</a></li>
182d9b96e04124d14c9f539109fb4e8cbd360d36trawick<li><img alt="" src="/images/down.gif" /> <a href="#rewriteengine">RewriteEngine</a></li>
182d9b96e04124d14c9f539109fb4e8cbd360d36trawick<li><img alt="" src="/images/down.gif" /> <a href="#rewritemap">RewriteMap</a></li>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick<li><img alt="" src="/images/down.gif" /> <a href="#rewriteoptions">RewriteOptions</a></li>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick<li><img alt="" src="/images/down.gif" /> <a href="#rewriterule">RewriteRule</a></li>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick<li><img alt="" src="/images/down.gif" /> <a href="#logging">Logging</a></li>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <p><code class="module"><a href="/mod/mod_rewrite.html">mod_rewrite</a></code> offers detailed logging of its actions
182d9b96e04124d14c9f539109fb4e8cbd360d36trawick at the <code>trace1</code> to <code>trace8</code> log levels. The
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick log level can be set specifically for <code class="module"><a href="/mod/mod_rewrite.html">mod_rewrite</a></code>
88c0d6d1cfdecfa8c2b6d7ae2482f06755cd7887trawick using the <code class="directive"><a href="/mod/core.html#loglevel">LogLevel</a></code> directive: Up to
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick level <code>debug</code>, no actions are logged, while <code>trace8</code>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick means that practically all actions are logged.</p>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick Using a high trace log level for <code class="module"><a href="/mod/mod_rewrite.html">mod_rewrite</a></code>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick will slow down your Apache HTTP Server dramatically! Use a log
182d9b96e04124d14c9f539109fb4e8cbd360d36trawick level higher than <code>trace2</code> only for debugging!
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick LogLevel alert rewrite:trace3
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <p>Those familiar with earlier versions of
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <code class="module"><a href="/mod/mod_rewrite.html">mod_rewrite</a></code> will no doubt be looking for the
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <code>RewriteLog</code> and <code>RewriteLogLevel</code>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick directives. This functionality has been completely replaced by the
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick new per-module logging configuration mentioned above.
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <p>To get just the <code class="module"><a href="/mod/mod_rewrite.html">mod_rewrite</a></code>-specific log
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick messages, pipe the log file through grep:</p>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick tail -f error_log|fgrep '[rewrite:'
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick<div class="directive-section"><h2><a name="RewriteBase" id="RewriteBase">RewriteBase</a> <a name="rewritebase" id="rewritebase">Directive</a></h2>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets the base URL for per-directory rewrites</td></tr>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>RewriteBase <em>URL-path</em></code></td></tr>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>None</code></td></tr>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick<tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_rewrite</td></tr>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <p>The <code class="directive">RewriteBase</code> directive explicitly
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick sets the base URL-path (not filesystem directory path!) for per-directory rewrites
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick that result in the substitution of a relative path.
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick When you use a <code class="directive"><a href="#rewriterule">RewriteRule</a></code>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick in a <code>.htaccess</code> file, <code class="module"><a href="/mod/mod_rewrite.html">mod_rewrite</a></code> strips off
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick the local directory prefix before processing, then rewrites the rest of
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick the URL. When the rewrite is completed, <code class="module"><a href="/mod/mod_rewrite.html">mod_rewrite</a></code>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick automatically adds the local directory prefix (or the
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <code class="directive">RewriteBase</code> when set) back on to the substitution
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick before handing it back to the core of the server as if it were the original
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <p>This directive is <em>required</em> for per-directory rewrites whose context
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick is a directory made available via the <code class="directive"><a href="/mod/mod_alias.html#alias">Alias</a></code>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick directive, when the substitution uses a relative path.</p>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <p>If your URL path does not exist verbatim on the filesystem,
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick or isn't directly under your <code class="directive"><a href="/mod/core.html#documentroot">DocumentRoot</a></code>,
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick you must use <code class="directive">RewriteBase</code> in every
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <code>.htaccess</code> file where you want to use <code class="directive"><a href="#rewriterule">RewriteRule</a></code> directives.</p>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <p>The example below demonstrates how to map
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick /home/www/example/newsite.html, in a <code>.htaccess</code> file. This
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick assumes that the content available at
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick http://example.com/ is on disk at /home/www/example/</p>
88c0d6d1cfdecfa8c2b6d7ae2482f06755cd7887trawickRewriteEngine On
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick# The URL-path used to get to this context, not the filesystem path
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawickRewriteBase /myapp/
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawickRewriteRule ^index\.html$ newsite.html
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick<div class="directive-section"><h2><a name="RewriteCond" id="RewriteCond">RewriteCond</a> <a name="rewritecond" id="rewritecond">Directive</a></h2>
182d9b96e04124d14c9f539109fb4e8cbd360d36trawick<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Defines a condition under which rewriting will take place
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code> RewriteCond
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <em>TestString</em> <em>CondPattern</em></code></td></tr>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick<tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_rewrite</td></tr>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <p>The <code class="directive">RewriteCond</code> directive defines a
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick rule condition. One or more <code class="directive">RewriteCond</code>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick can precede a <code class="directive"><a href="#rewriterule">RewriteRule</a></code>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick directive. The following rule is then only used if both
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick the current state of the URI matches its pattern, <strong>and</strong> if these conditions are met.</p>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <p><em>TestString</em> is a string which can contain the
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick following expanded constructs in addition to plain text:</p>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <strong>RewriteRule backreferences</strong>: These are
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick backreferences of the form <strong><code>$N</code></strong>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick (0 <= N <= 9). $1 to $9 provide access to the grouped
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick parts (in parentheses) of the pattern, from the
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <code>RewriteRule</code> which is subject to the current
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick set of <code>RewriteCond</code> conditions. $0 provides
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick access to the whole string matched by that pattern.
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <strong>RewriteCond backreferences</strong>: These are
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick backreferences of the form <strong><code>%N</code></strong>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick (0 <= N <= 9). %1 to %9 provide access to the grouped
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick parts (again, in parentheses) of the pattern, from the last matched
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick of conditions. %0 provides access to the whole string matched by
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick that pattern.
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick expansions of the form <strong><code>${mapname:key|default}</code></strong>.
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick RewriteMap</a> for more details.
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <strong>Server-Variables</strong>: These are variables of
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick where <em>NAME_OF_VARIABLE</em> can be a string taken
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick from the following list:
88c0d6d1cfdecfa8c2b6d7ae2482f06755cd7887trawick <th>HTTP headers:</th> <th>connection & request:</th> <th />
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick HTTP_USER_AGENT<br />
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick HTTP_REFERER<br />
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick HTTP_COOKIE<br />
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick HTTP_FORWARDED<br />
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick HTTP_HOST<br />
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick HTTP_PROXY_CONNECTION<br />
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick HTTP_ACCEPT<br />
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick REMOTE_ADDR<br />
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick REMOTE_HOST<br />
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick REMOTE_PORT<br />
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick REMOTE_USER<br />
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick REMOTE_IDENT<br />
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick REQUEST_METHOD<br />
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick SCRIPT_FILENAME<br />
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick PATH_INFO<br />
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick QUERY_STRING<br />
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick AUTH_TYPE<br />
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <th>server internals:</th> <th>date and time:</th> <th>specials:</th>
182d9b96e04124d14c9f539109fb4e8cbd360d36trawick DOCUMENT_ROOT<br />
182d9b96e04124d14c9f539109fb4e8cbd360d36trawick SERVER_ADMIN<br />
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick SERVER_NAME<br />
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick SERVER_ADDR<br />
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick SERVER_PORT<br />
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick SERVER_PROTOCOL<br />
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick SERVER_SOFTWARE<br />
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick TIME_YEAR<br />
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick TIME_MON<br />
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick TIME_DAY<br />
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick TIME_HOUR<br />
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick TIME_MIN<br />
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick TIME_SEC<br />
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick TIME_WDAY<br />
182d9b96e04124d14c9f539109fb4e8cbd360d36trawick API_VERSION<br />
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick THE_REQUEST<br />
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick REQUEST_URI<br />
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick REQUEST_FILENAME<br />
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick IS_SUBREQ<br />
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick HTTPS<br />
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick REQUEST_SCHEME<br />
88c0d6d1cfdecfa8c2b6d7ae2482f06755cd7887trawick <p>These variables all
182d9b96e04124d14c9f539109fb4e8cbd360d36trawick correspond to the similarly named HTTP
182d9b96e04124d14c9f539109fb4e8cbd360d36trawick MIME-headers, C variables of the Apache HTTP Server or
182d9b96e04124d14c9f539109fb4e8cbd360d36trawick Most are documented elsewhere in the Manual or in
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick the CGI specification.</p>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <p>SERVER_NAME and SERVER_PORT depend on the values of
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <code class="directive"><a href="/mod/core.html#usecanonicalname">UseCanonicalName</a></code> and
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <code class="directive"><a href="/mod/core.html#usecanonicalphysicalport">UseCanonicalPhysicalPort</a></code>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick respectively.</p>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <p>Those that are special to mod_rewrite include those below.</p>
182d9b96e04124d14c9f539109fb4e8cbd360d36trawick <dd>Will contain the text "true" if the request
182d9b96e04124d14c9f539109fb4e8cbd360d36trawick currently being processed is a sub-request,
182d9b96e04124d14c9f539109fb4e8cbd360d36trawick "false" otherwise. Sub-requests may be generated
182d9b96e04124d14c9f539109fb4e8cbd360d36trawick by modules that need to resolve additional files
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick or URIs in order to complete their tasks.</dd>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <dd>This is the version of the Apache httpd module API
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick (the internal interface between server and
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick module) in the current httpd build, as defined in
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick corresponds to the version of Apache httpd in use (in
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick the release version of Apache httpd 1.3.14, for
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick instance, it is 19990320:10), but is mainly of
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick interest to module authors.</dd>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <dd>The full HTTP request line sent by the
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick include any additional headers sent by the
88c0d6d1cfdecfa8c2b6d7ae2482f06755cd7887trawick browser. This value has not been unescaped
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick (decoded), unlike most other variables below.</dd>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <dd>The path component of the requested URI,
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick such as "/index.html". This notably excludes the
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick query string which is available as as its own variable
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <dd>The full local filesystem path to the file or
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick script matching the request, if this has already
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick been determined by the server at the time
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <code>REQUEST_FILENAME</code> is referenced. Otherwise,
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick such as when used in virtual host context, the same
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <dd>Will contain the text "on" if the connection is
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick can be safely used regardless of whether or not
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <code class="module"><a href="/mod/mod_ssl.html">mod_ssl</a></code> is loaded).</dd>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <dd>Will contain the scheme of the request (ususally
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick "http" or "https"). This value can be influenced with
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <code class="directive"><a href="/mod/core.html#servername">ServerName</a></code>.</dd>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <p>If the <em>TestString</em> has the special value <code>expr</code>, the
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <p>The variables SCRIPT_FILENAME and REQUEST_FILENAME
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick contain the same value - the value of the
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <code>request_rec</code> structure of the Apache HTTP Server.
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick The first name is the commonly known CGI variable name
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick while the second is the appropriate counterpart of
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick REQUEST_URI (which contains the value of the
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <code>uri</code> field of <code>request_rec</code>).</p>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <p>If a substitution occurred and the rewriting continues,
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick the value of both variables will be updated accordingly.</p>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <p>If used in per-server context (<em>i.e.</em>, before the
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick request is mapped to the filesystem) SCRIPT_FILENAME and
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick REQUEST_FILENAME cannot contain the full local filesystem
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick path since the path is unknown at this stage of processing.
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick Both variables will initially contain the value of REQUEST_URI
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick in that case. In order to obtain the full local filesystem
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick path of the request in per-server context, use an URL-based
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick look-ahead <code>%{LA-U:REQUEST_FILENAME}</code> to determine
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <code>%{ENV:variable}</code>, where <em>variable</em> can be
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick any environment variable, is also available.
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick This is looked-up via internal
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick Apache httpd structures and (if not found there) via
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <code>getenv()</code> from the Apache httpd server process.</li>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <code>%{SSL:variable}</code>, where <em>variable</em> is the
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick name of an <a href="mod_ssl.html#envvars">SSL environment
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick variable</a>, can be used whether or not
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <code class="module"><a href="/mod/mod_ssl.html">mod_ssl</a></code> is loaded, but will always expand to
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick the empty string if it is not. Example:
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <code>%{SSL:SSL_CIPHER_USEKEYSIZE}</code> may expand to
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <code>%{HTTP:header}</code>, where <em>header</em> can be
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick any HTTP MIME-header name, can always be used to obtain the
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick value of a header sent in the HTTP request.
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick the value of the HTTP header
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <p>If a HTTP header is used in a condition this header is added to
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick the Vary header of the response in case the condition evaluates to
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick to true for the request. It is <strong>not</strong> added if the
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick condition evaluates to false for the request. Adding the HTTP header
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick to the Vary header of the response is needed for proper caching.</p>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <p>It has to be kept in mind that conditions follow a short circuit
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick logic in the case of the '<strong><code>ornext|OR</code></strong>' flag
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick so that certain conditions might not be evaluated at all.</p></li>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <code>%{LA-U:variable}</code> can be used for look-aheads which perform
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick an internal (URL-based) sub-request to determine the final
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick value of <em>variable</em>. This can be used to access
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick variable for rewriting which is not available at the current
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick stage, but will be set in a later phase.
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <p>For instance, to rewrite according to the
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick per-server context (<code>httpd.conf</code> file) you must
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick variable is set by the authorization phases, which come
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <em>after</em> the URL translation phase (during which mod_rewrite
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick operates).</p>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <p>On the other hand, because mod_rewrite implements
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick its per-directory context (<code>.htaccess</code> file) via
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick the Fixup phase of the API and because the authorization
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick phases come <em>before</em> this phase, you just can use
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <code>%{REMOTE_USER}</code> in that context.</p></li>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <code>%{LA-F:variable}</code> can be used to perform an internal
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick (filename-based) sub-request, to determine the final value
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick of <em>variable</em>. Most of the time, this is the same as
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick LA-U above.</li>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick a regular expression which is applied to the
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <em>TestString</em> is first evaluated, before being matched against
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <em>perl compatible regular expression</em>, but there is
88c0d6d1cfdecfa8c2b6d7ae2482f06755cd7887trawick additional syntax available to perform other useful tests against
88c0d6d1cfdecfa8c2b6d7ae2482f06755cd7887trawick <li>You can prefix the pattern string with a
88c0d6d1cfdecfa8c2b6d7ae2482f06755cd7887trawick '<code>!</code>' character (exclamation mark) to specify a
88c0d6d1cfdecfa8c2b6d7ae2482f06755cd7887trawick You can perform lexicographical string comparisons:
88c0d6d1cfdecfa8c2b6d7ae2482f06755cd7887trawick <li>'<strong><CondPattern</strong>' (lexicographically
88c0d6d1cfdecfa8c2b6d7ae2482f06755cd7887trawick precedes)<br />
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick Treats the <em>CondPattern</em> as a plain string and
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick compares it lexicographically to <em>TestString</em>. True if
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <li>'<strong>>CondPattern</strong>' (lexicographically
88c0d6d1cfdecfa8c2b6d7ae2482f06755cd7887trawick follows)<br />
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick Treats the <em>CondPattern</em> as a plain string and
88c0d6d1cfdecfa8c2b6d7ae2482f06755cd7887trawick compares it lexicographically to <em>TestString</em>. True if
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <li>'<strong>=CondPattern</strong>' (lexicographically
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick equal)<br />
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick Treats the <em>CondPattern</em> as a plain string and
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick compares it lexicographically to <em>TestString</em>. True if
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick equal, character for character). If <em>CondPattern</em>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick compares <em>TestString</em> to the empty string.</li>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <li>'<strong><=CondPattern</strong>' (lexicographically
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick less than or equal to)<br />
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick Treats the <em>CondPattern</em> as a plain string and
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick compares it lexicographically to <em>TestString</em>. True
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <em>CondPattern</em>, or is equal to <em>CondPattern</em>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick (the two strings are equal, character for character).</li>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <li>'<strong>>=CondPattern</strong>' (lexicographically
182d9b96e04124d14c9f539109fb4e8cbd360d36trawick greater than or equal to)<br />
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick Treats the <em>CondPattern</em> as a plain string and
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick compares it lexicographically to <em>TestString</em>. True
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <em>CondPattern</em>, or is equal to <em>CondPattern</em>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick (the two strings are equal, character for character).</li>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick You can perform integer comparisons:
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick The <em>TestString</em> is treated as an integer, and is
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick numerically compared to the <em>CondPattern</em>. True if
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick the two are numerically equal.</li>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <strong>g</strong>reater than or <strong>e</strong>qual to)<br />
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick The <em>TestString</em> is treated as an integer, and is
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick numerically compared to the <em>CondPattern</em>. True if
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick the <em>TestString</em> is numerically greater than or equal
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <strong>g</strong>reater <strong>t</strong>han)<br />
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick The <em>TestString</em> is treated as an integer, and is
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick numerically compared to the <em>CondPattern</em>. True if
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <strong>l</strong>ess than or <strong>e</strong>qual to)<br />
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick The <em>TestString</em> is treated as an integer, and is
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick numerically compared to the <em>CondPattern</em>. True if
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick the <em>TestString</em> is numerically less than or equal
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick to the <em>CondPattern</em>. Avoid confusion with the
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <strong>-l</strong> by using the <strong>-L</strong> or
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick The <em>TestString</em> is treated as an integer, and is
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick numerically compared to the <em>CondPattern</em>. True if
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <strong>-l</strong> by using the <strong>-L</strong> or
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <li>You can perform various file attribute tests:
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick Treats the <em>TestString</em> as a pathname and tests
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick whether or not it exists, and is a directory.</li>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick Treats the <em>TestString</em> as a pathname and tests
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick whether or not it exists, and is a regular file.</li>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick subrequest)<br />
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick Checks whether or not <em>TestString</em> is a valid file,
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick accessible via all the server's currently-configured
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick access controls for that path. This uses an internal
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick subrequest to do the check, so use it with care -
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick it can impact your server's performance!</li>
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <li>'<strong>-H</strong>' (is symbolic link, bash convention)<br />
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick Treats the <em>TestString</em> as a pathname and tests
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick whether or not it exists, and is a symbolic link. May also
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <strong>-h</strong> if there's a possibility of confusion
fcd5c4e9e126e867eb270ed2d4138348cb1e46e5trawick <li>'<strong>-L</strong>' (is symbolic link, bash convention)<br />
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="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
<dd>Randomly selects an entry from a plain text file (<a href="/rewrite/rewritemap.html#rnd">Details ...</a>)</dd>
<p>Further details, and numerous examples, may be found in the <a href="/rewrite/rewritemap.html">RewriteMap HowTo</a></p>
<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#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 no longer available in version 2.1 and
<p>By default, <code class="module"><a href="/mod/mod_rewrite.html">mod_rewrite</a></code> will ignore URLs that map to a
the <code class="module"><a href="/mod/mod_dir.html">mod_dir</a></code> module will issue the client with a redirect to
<p>When the <code class="directive"><a href="/mod/mod_dir.html#directoryslash">DirectorySlash</a></code> directive
<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>
<p>In <code class="directive"><a href="/mod/core.html#directory">Directory</a></code> and htaccess context,
<li>The rewrite engine may be used in <a href="/howto/htaccess.html">.htaccess</a> files and in <code class="directive"><a href="/mod/core.html#directory"><Directory></a></code> sections, with some additional
<li>Although rewrite rules are syntactically permitted in <code class="directive"><a href="/mod/core.html#location"><Location></a></code> and <code class="directive"><a href="/mod/core.html#files"><Files></a></code> sections, this
<p>For some hints on <a class="glossarylink" href="/glossary.html#regex" title="see glossary">regular
<dd>A <code class="directive"><a href="/mod/core.html#documentroot">DocumentRoot</a></code>-relative path to the
resource to be served. Note that <code class="module"><a href="/mod/mod_rewrite.html">mod_rewrite</a></code>
URL-mapping directives (such as <code class="directive"><a href="/mod/mod_alias.html#alias">Alias</a></code>) to be applied to the
<code class="module"><a href="/mod/mod_rewrite.html">mod_rewrite</a></code> checks to see whether the
in the config file. The URI or file path (see <a href="#what_is_matched">"What is matched?"</a>, above) is <strong>completely
<p>Additionally you can set special <a name="rewriteflags" id="rewriteflags">actions</a> to be performed by
details, and examples, for each flag, are available in the <a href="/rewrite/flags.html">Rewrite Flags document</a>.</p>
the rule(s) chained to it will be skipped. <em><a href="/rewrite/flags.html#flag_c">details ...</a></em></td>
CO=<em>NAME</em>:<em>VAL</em>:<em>domain</em>[:<em>lifetime</em>[:<em>path</em>[:<em>secure</em>[:<em>httponly</em>]]]] <em><a href="/rewrite/flags.html#flag_co">details ...</a></em>
the environment variable <em>VAR</em> to be unset.<em><a href="/rewrite/flags.html#flag_e">details ...</a></em></td>
<td>Returns a 410 GONE response to the client browser. <em><a href="/rewrite/flags.html#flag_g">details ...</a></em></td>
<em>Content-handler</em> for processing. <em><a href="/rewrite/flags.html#flag_h">details ...</a></em></td>
.htaccess context (see also the END flag). <em><a href="/rewrite/flags.html#flag_l">details ...</a></em></td>
special characters in the result of the rewrite. <em><a href="/rewrite/flags.html#flag_ne">details ...</a></em></td>
any query string created in the rewrite target.<em><a href="/rewrite/flags.html#flag_qsa">details ...</a></em></td>
rules if the current rule matches. <em><a href="/rewrite/flags.html#flag_s">details ...</a></em></td>
<td>Force the <a class="glossarylink" href="/glossary.html#mime-type" title="see glossary">MIME-type</a> of the target file
<p><span>Available Languages: </span><a href="/en/mod/mod_rewrite.html" title="English"> en </a> |
<a href="/fr/mod/mod_rewrite.html" hreflang="fr" rel="alternate" title="Fran�ais"> fr </a></p>
<p class="apache">Copyright 2012 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>