mod_rewrite.html.en revision e619b7228ac42d9c70d6a5f02d808b0d2880080c
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd This file is generated from xml source: DO NOT EDIT
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd<link href="/style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd<link href="/style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen<link href="/style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen<link href="/images/favicon.ico" rel="shortcut icon" /></head>
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd<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>
3f08db06526d6901aa08c110b5bc7dde6bc39905nd<div class="up"><a href="./"><img title="<-" alt="<-" src="/images/left.gif" /></a></div>
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd<a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="../">Version 2.3</a> > <a href="./">Modules</a></div>
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd<p><span>Available Languages: </span><a href="/en/mod/mod_rewrite.html" title="English"> en </a> |
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd<a href="/fr/mod/mod_rewrite.html" hreflang="fr" rel="alternate" title="Fran�ais"> fr </a></p>
bc9d4698fce0238d2f6f2682e99423ebb1149976rbowen<table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Provides a rule-based rewriting engine to rewrite requested
63f06dce77bb2d9b1c5aa5deeb47a1069987fd1end<tr><th><a href="module-dict.html#Status">Status:</a></th><td>Extension</td></tr>
d474d8ef01ec5c2a09341cd148851ed383c3287crbowen<tr><th><a href="module-dict.html#ModuleIdentifier">Module�Identifier:</a></th><td>rewrite_module</td></tr>
d474d8ef01ec5c2a09341cd148851ed383c3287crbowen<tr><th><a href="module-dict.html#SourceFile">Source�File:</a></th><td>mod_rewrite.c</td></tr>
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd<tr><th><a href="module-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 1.3 and later</td></tr></table>
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd <p>The <code class="module"><a href="/mod/mod_rewrite.html">mod_rewrite</a></code> module uses a rule-based rewriting
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd engine, based on a regular-expression parser, to rewrite requested URLs on
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd the fly. By default, <code class="module"><a href="/mod/mod_rewrite.html">mod_rewrite</a></code> maps a URL to a filesystem
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd path. However, it can also be used to redirect one URL to another URL, or
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd to invoke an internal proxy fetch.</p>
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd <p><code class="module"><a href="/mod/mod_rewrite.html">mod_rewrite</a></code> provides a flexible and powerful way to
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd manipulate URLs using an unlimited number of rules. Each rule can have an
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd unlimited number of attached rule conditions, to allow you to rewrite URL
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd based on server variables, environment variables, HTTP headers, or time
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd stamps.</p>
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd <p><code class="module"><a href="/mod/mod_rewrite.html">mod_rewrite</a></code> operates on the full URL path, including the
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd path-info section. A rewrite rule can be invoked in
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd <code>httpd.conf</code> or in <code>.htaccess</code>. The path generated
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd by a rewrite rule can include a query string, or can lead to internal
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd sub-processing, external request redirection, or internal proxy
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd throughput.</p>
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd <p>Further details, discussion, and examples, are provided in the
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd <a href="/rewrite/">detailed mod_rewrite documentation</a>.</p>
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd<div id="quickview"><h3 class="directives">Directives</h3>
80eed96ee3d8cfa0b66d9fb1cfe63fd83254d38bnilgun<li><img alt="" src="/images/down.gif" /> <a href="#rewritebase">RewriteBase</a></li>
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd<li><img alt="" src="/images/down.gif" /> <a href="#rewritecond">RewriteCond</a></li>
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd<li><img alt="" src="/images/down.gif" /> <a href="#rewriteengine">RewriteEngine</a></li>
316f02e3836836c82e19019ff23f90a7ebc65289nilgun<li><img alt="" src="/images/down.gif" /> <a href="#rewritelock">RewriteLock</a></li>
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd<li><img alt="" src="/images/down.gif" /> <a href="#rewritelog">RewriteLog</a></li>
864d6d55a72bdb982ebabbc95cf8f051c43fa6ddrbowen<li><img alt="" src="/images/down.gif" /> <a href="#rewriteloglevel">RewriteLogLevel</a></li>
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd<li><img alt="" src="/images/down.gif" /> <a href="#rewritemap">RewriteMap</a></li>
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd<li><img alt="" src="/images/down.gif" /> <a href="#rewriteoptions">RewriteOptions</a></li>
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd<li><img alt="" src="/images/down.gif" /> <a href="#rewriterule">RewriteRule</a></li>
22d5d84393d960a2027f472036f3fee15d7dbce9nd<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
22d5d84393d960a2027f472036f3fee15d7dbce9nd<div class="directive-section"><h2><a name="RewriteBase" id="RewriteBase">RewriteBase</a> <a name="rewritebase" id="rewritebase">Directive</a></h2>
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets the base URL for per-directory rewrites</td></tr>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>RewriteBase <em>URL-path</em></code></td></tr>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>None</code></td></tr>
4b311579b2c8aebac85fb7cb8ac89e6c37b4bc1asf<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory, .htaccess</td></tr>
50c04f297d76a57ead2fa6b73845f7563b1fc788sf<tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_rewrite</td></tr>
623eebe956d9c2d6d073ed3eae855b56030b40e9noodl <p>The <code class="directive">RewriteBase</code> directive explicitly
a78048ccbdb6256da15e6b0e7e95355e480c2301nd sets the base URL for per-directory rewrites.
a78048ccbdb6256da15e6b0e7e95355e480c2301nd When you use a <code class="directive"><a href="#rewriterule">RewriteRule</a></code>
ffb88a4885747797937e30a5ac8b1606da3cb4adnd in a <code>.htaccess</code> file, <code class="module"><a href="/mod/mod_rewrite.html">mod_rewrite</a></code> strips off
909ce17e2bd0faef7b1c294f2307f009793fd493nd the local directory prefix before processing, then rewrites the rest of
a78048ccbdb6256da15e6b0e7e95355e480c2301nd the URL. When the rewrite is completed, <code class="module"><a href="/mod/mod_rewrite.html">mod_rewrite</a></code>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd automatically adds the local directory prefix back on to the path.</p>
cd34a6fbf0a2619544a72eadb73f309370bf6682wrowe <p>If your URL path does not exist on the filesystem,
42af92a661a06b3cebc88d585aad75064a309d51nd you must use <code class="directive">RewriteBase</code> in every
42af92a661a06b3cebc88d585aad75064a309d51nd <code>.htaccess</code> file where you want to use <code class="directive"><a href="#rewriterule">RewriteRule</a></code> directives. </p>
6fe26506780e73be2a412d758af77fafdf03291and <p>The example below demonstrates how to map
a78048ccbdb6256da15e6b0e7e95355e480c2301nd <code>/home/www/example/newsite.html</code>, in a <code>.htaccess</code>
9649d29bb7801e0698e6a845e1a8a61534df58b3noodl file. This assumes that the content available at
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndRewriteEngine On
0853e1e2522c1ac17f697221758bcbd4781a7ff9ndRewriteBase /foo/
08cf4a15275e4cb65a424b3a1db5410bfb51085cjimRewriteRule ^index\.html$ newsite.html
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
8574d86b9ec3be36b7f54ed0547a0ee5d60dbd6bnd<div class="directive-section"><h2><a name="RewriteCond" id="RewriteCond">RewriteCond</a> <a name="rewritecond" id="rewritecond">Directive</a></h2>
8574d86b9ec3be36b7f54ed0547a0ee5d60dbd6bnd<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Defines a condition under which rewriting will take place
7906201913b68fe78b9d6a22ab33bf21d82c490eminfrin<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code> RewriteCond
8574d86b9ec3be36b7f54ed0547a0ee5d60dbd6bnd <em>TestString</em> <em>CondPattern</em></code></td></tr>
8574d86b9ec3be36b7f54ed0547a0ee5d60dbd6bnd<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
864d6d55a72bdb982ebabbc95cf8f051c43fa6ddrbowen<tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
e8b603fa9ccf7b17b11b42df6d8916fd97c2331dnd<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
8574d86b9ec3be36b7f54ed0547a0ee5d60dbd6bnd<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_rewrite</td></tr>
8574d86b9ec3be36b7f54ed0547a0ee5d60dbd6bnd <p>The <code class="directive"><a href="#rewritecond">RewriteCond</a></code>
8574d86b9ec3be36b7f54ed0547a0ee5d60dbd6bnd directive defines a rule condition. One or more <code class="directive"><a href="#rewritecond">RewriteCond</a></code>
611049e38bfbaeb173d2d7fab2e44a48753436a1nd conditions can precede a <code class="directive"><a href="#rewriterule">RewriteRule</a></code> directive. The following rewrite rule is then
8574d86b9ec3be36b7f54ed0547a0ee5d60dbd6bnd used only if these conditions are met, and if the URI matches the pattern
8574d86b9ec3be36b7f54ed0547a0ee5d60dbd6bnd specified in the rule.</p>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd <div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
6aadbc6fd703e73d1d419e9f06b84a4338c898f1maczniak<h2><a name="TestString" id="TestString">TestString</a></h2>
a78048ccbdb6256da15e6b0e7e95355e480c2301nd <p><code><em>TestString</em></code> can contain plain text, any of the
a78048ccbdb6256da15e6b0e7e95355e480c2301nd following expanded constructs, or both.</p>
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak <strong>RewriteRule backreferences</strong>: These are
864d6d55a72bdb982ebabbc95cf8f051c43fa6ddrbowen backreferences of the form <strong><code>$N</code></strong>
864d6d55a72bdb982ebabbc95cf8f051c43fa6ddrbowen (1 <= N <= 9). They provide access to the grouped
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak parts of the current <code>RewriteRule</code> pattern. The grouped
4b5981e276e93df97c34e4da05ca5cf8bbd937dand parts of the pattern are those in parentheses.</li>
f21bea4c0f58e17aa1d9a0fac2c219852f89944amaczniak <strong>RewriteCond backreferences</strong>: These are
6aadbc6fd703e73d1d419e9f06b84a4338c898f1maczniak backreferences of the form <strong><code>%N</code></strong>
2704de98885368683621b01c8f8f4e4b01557611takashi (1 <= N <= 9). They provide access to the grouped
2704de98885368683621b01c8f8f4e4b01557611takashi parts of the last-matched <code>RewriteCond</code> pattern. The
2704de98885368683621b01c8f8f4e4b01557611takashi grouped parts of the pattern are those in parentheses.</li>
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd expansions of the form <strong><code>${mapname:key|default}</code></strong>.
6aadbc6fd703e73d1d419e9f06b84a4338c898f1maczniak See the <a href="#mapfunc">RewriteMap documentation</a>
c819c19c2f1ffbf3a3f12a4070cc6c3f4ea2a6f2sf for more details.
4ed26c413f67a5aae20b95909828f30bb5dc2286poirier <strong>Server variables</strong>: These are variables of
e60187855fd0488f48f37e88acde742754308d39rbowen <strong><code>%{ <em>NAME_OF_VARIABLE</em> }</code></strong>,
04bab87733a0e93a926e82311c85cd8ac06a032fnd where <em>NAME_OF_VARIABLE</em> is one of the server variables from
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd the table below:
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd <th>HTTP headers:</th> <th>connection & request:</th> <th />
a610901168de82df5fc5d99b8759fd80e0f70aeasf HTTP_USER_AGENT<br />
a43bfa789f4e52dde53ae8e53fa0427b5c1cf977nd HTTP_REFERER<br />
a43bfa789f4e52dde53ae8e53fa0427b5c1cf977nd HTTP_COOKIE<br />
28c9d384aa958b321280b4ac886941dcad25396bnd HTTP_FORWARDED<br />
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd HTTP_HOST<br />
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd HTTP_PROXY_CONNECTION<br />
438b4817913a5ff55d9cad4c7ddf133330b4466ejim HTTP_ACCEPT<br />
604c89126c27104f659d7a51b0113e3bd435faf8fielding REMOTE_ADDR<br />
50cb7e2b30597f481fee57bac945190f06ebcc58jorton REMOTE_HOST<br />
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd REMOTE_PORT<br />
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd REMOTE_USER<br />
4126704c4950bfd46d32ad54e3b106ac6d868a73sf REMOTE_IDENT<br />
4126704c4950bfd46d32ad54e3b106ac6d868a73sf REQUEST_METHOD<br />
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd SCRIPT_FILENAME<br />
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd PATH_INFO<br />
0a69d9bb491d9810892a9949c01403a1de3c7ac2nd QUERY_STRING<br />
4ed26c413f67a5aae20b95909828f30bb5dc2286poirier AUTH_TYPE<br />
11495c9f0bd33e51a25b4d532beadfbcf9b944a3nilgun <th>server internals:</th> <th>date and time:</th> <th>specials:</th>
79b024b81f6bb3c44dce77a7552191daf8b522d2jim DOCUMENT_ROOT<br />
f772e8f448c223e5ea306f1bf92d97d968f972d5jim SERVER_ADMIN<br />
f772e8f448c223e5ea306f1bf92d97d968f972d5jim SERVER_NAME<br />
fac8c35bfb158112226ab43ddf84d59daca5dc30nd SERVER_ADDR<br />
f772e8f448c223e5ea306f1bf92d97d968f972d5jim SERVER_PORT<br />
1de1266f0ea387d6373be8415745dfd2ab876341jim SERVER_PROTOCOL<br />
1de1266f0ea387d6373be8415745dfd2ab876341jim SERVER_SOFTWARE<br />
5effc8b39fae5cd169d17f342bfc265705840014rbowen TIME_YEAR<br />
5effc8b39fae5cd169d17f342bfc265705840014rbowen TIME_MON<br />
5effc8b39fae5cd169d17f342bfc265705840014rbowen TIME_DAY<br />
a78048ccbdb6256da15e6b0e7e95355e480c2301nd TIME_HOUR<br />
a78048ccbdb6256da15e6b0e7e95355e480c2301nd TIME_MIN<br />
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd TIME_SEC<br />
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd TIME_WDAY<br />
a78048ccbdb6256da15e6b0e7e95355e480c2301nd TIME<br />
a78048ccbdb6256da15e6b0e7e95355e480c2301nd API_VERSION<br />
50cb7e2b30597f481fee57bac945190f06ebcc58jorton THE_REQUEST<br />
a78048ccbdb6256da15e6b0e7e95355e480c2301nd REQUEST_URI<br />
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd REQUEST_FILENAME<br />
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd IS_SUBREQ<br />
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd HTTPS<br />
b43f840409794ed298e8634f6284741f193b6c4ftakashi <div class="note"><p>The following variables are specific to
4126704c4950bfd46d32ad54e3b106ac6d868a73sf <code class="module"><a href="/mod/mod_rewrite.html">mod_rewrite</a></code>:</p>
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd <dd>Contains the text "true" if the request
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd currently being processed is a sub-request, or
ecc5150d35c0dc5ee5119c2717e6660fa331abbftakashi "false" otherwise. Sub-requests may be generated
bc9d4698fce0238d2f6f2682e99423ebb1149976rbowen by modules that need to resolve additional files
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd or URIs in order to complete their tasks.</dd>
0853e1e2522c1ac17f697221758bcbd4781a7ff9nd <dd>The version of the Apache module API contained in the
1a1356f375e36db7bee379ea0684ab389579f798rbowen current httpd build, as defined in
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd <dd>The full HTTP request line sent by the
does not depend on <code class="module"><a href="/mod/mod_ssl.html">mod_ssl</a></code> being loaded.</dd>
variable</a>. If <code class="module"><a href="/mod/mod_ssl.html">mod_ssl</a></code> is not loaded, this
within <code>httpd.conf</code>, you must use <code>%{LA-U:REMOTE_USER}</code>. To obtain the value of the
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 <code class="directive"><a href="#rewritemap">RewriteMap</a></code>
<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
<p>To create a dbm file from a source text file, use the <a href="/programs/httxt2dbm.html">httxt2dbm</a> utility.</p>
# ...put here any transformations or lookups...
<p>This uses <code class="module"><a href="/mod/mod_dbd.html">mod_dbd</a></code> to implement a rewritemap
<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
<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>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
<p>Additionally you can set special <a name="rewriteflags" id="rewriteflags">actions</a> to be performed by
RewriteRule ^(/.*)$ /index.php?show=$1
<dt>'<code>cookie|CO=</code><em>NAME</em>:<em>VAL</em>:<em>domain</em>[:<em>lifetime</em>[:<em>path</em>[:<em>secure</em>[:<em>httponly</em>]]]]'
in Apache when <code class="module"><a href="/mod/mod_dir.html">mod_dir</a></code> tries to find out
<p>Note: <code class="module"><a href="/mod/mod_proxy.html">mod_proxy</a></code> must be enabled in order
Force the <a class="glossarylink" href="/glossary.html#mime-type" title="see glossary">MIME-type</a> of the target file to be
<p>The rewrite engine may be used in <a href="/howto/htaccess.html">.htaccess</a> files. To enable the
<p>The rewrite engine may also be used in <code class="directive"><a href="/mod/core.html#directory"><Directory></a></code> sections with the same
virtual host context, rather than in a <code class="directive"><a href="/mod/core.html#directory"><Directory></a></code> section.</p>
<p>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
^/somepath(.*) /otherpath$1 [R] http://thishost/otherpath/pathinfo
^/somepath(.*) http://thishost/otherpath$1 [P] doesn't make sense, not supported
^localpath(.*) otherpath$1 [R] http://thishost/somepath/otherpath/pathinfo
^localpath(.*) /otherpath$1 [R] http://thishost/otherpath/pathinfo
^localpath(.*) http://thishost/otherpath$1 [P] doesn't make sense, not supported
<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 2009 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>