summaryrefslogtreecommitdiffstats
path: root/docs/manual/rewrite
diff options
context:
space:
mode:
Diffstat (limited to 'docs/manual/rewrite')
-rw-r--r--docs/manual/rewrite/access.html.en46
-rw-r--r--docs/manual/rewrite/access.xml46
-rw-r--r--docs/manual/rewrite/advanced.html.en26
-rw-r--r--docs/manual/rewrite/advanced.xml26
-rw-r--r--docs/manual/rewrite/flags.html.en92
-rw-r--r--docs/manual/rewrite/flags.xml66
-rw-r--r--docs/manual/rewrite/flags.xml.fr2
-rw-r--r--docs/manual/rewrite/index.xml2
-rw-r--r--docs/manual/rewrite/intro.html.en54
-rw-r--r--docs/manual/rewrite/intro.xml56
-rw-r--r--docs/manual/rewrite/proxy.html.en10
-rw-r--r--docs/manual/rewrite/proxy.xml10
-rw-r--r--docs/manual/rewrite/remapping.html.en88
-rw-r--r--docs/manual/rewrite/remapping.xml84
-rw-r--r--docs/manual/rewrite/rewritemap.html.en35
-rw-r--r--docs/manual/rewrite/rewritemap.xml30
-rw-r--r--docs/manual/rewrite/tech.html.en16
-rw-r--r--docs/manual/rewrite/tech.xml21
-rw-r--r--docs/manual/rewrite/vhosts.html.en40
-rw-r--r--docs/manual/rewrite/vhosts.xml40
20 files changed, 393 insertions, 397 deletions
diff --git a/docs/manual/rewrite/access.html.en b/docs/manual/rewrite/access.html.en
index ab61fa31e3..da3e826d2d 100644
--- a/docs/manual/rewrite/access.html.en
+++ b/docs/manual/rewrite/access.html.en
@@ -78,25 +78,25 @@ configuration.</div>
-<pre class="prettyprint lang-config">RewriteCond %{HTTP_REFERER} !^$
-RewriteCond %{HTTP_REFERER} !www.example.com [NC]
-RewriteRule \.(gif|jpg|png)$ - [F,NC]</pre>
+<pre class="prettyprint lang-config">RewriteCond "%{HTTP_REFERER}" "!^$"
+RewriteCond "%{HTTP_REFERER}" "!www.example.com" [NC]
+RewriteRule "\.(gif|jpg|png)$" "-" [F,NC]</pre>
<p>In this second example, instead of failing the request, we display
an alternate image instead.</p>
-<pre class="prettyprint lang-config">RewriteCond %{HTTP_REFERER} !^$
-RewriteCond %{HTTP_REFERER} !www.example.com [NC]
-RewriteRule \.(gif|jpg|png)$ /images/go-away.png [R,NC]</pre>
+<pre class="prettyprint lang-config">RewriteCond "%{HTTP_REFERER}" "!^$"
+RewriteCond "%{HTTP_REFERER}" "!www.example.com" [NC]
+RewriteRule "\.(gif|jpg|png)$" "/images/go-away.png" [R,NC]</pre>
<p>In the third example, we redirect the request to an image on some
other site.</p>
-<pre class="prettyprint lang-config">RewriteCond %{HTTP_REFERER} !^$
-RewriteCond %{HTTP_REFERER} !www.example.com [NC]
-RewriteRule \.(gif|jpg|png)$ http://other.example.com/image.gif [R,NC]</pre>
+<pre class="prettyprint lang-config">RewriteCond "%{HTTP_REFERER}" "!^$"
+RewriteCond "%{HTTP_REFERER}" "!www.example.com" [NC]
+RewriteRule "\.(gif|jpg|png)$" "http://other.example.com/image.gif" [R,NC]</pre>
<p>Of these techniques, the last two tend to be the most effective
@@ -159,9 +159,9 @@ RewriteRule \.(gif|jpg|png)$ http://other.example.com/image.gif [R,NC]</pre>
range, if you are trying to block that user agent only from the
particular source.</p>
-<pre class="prettyprint lang-config">RewriteCond %{HTTP_USER_AGENT} ^NameOfBadRobot
-RewriteCond %{REMOTE_ADDR} =123\.45\.67\.[8-9]
-RewriteRule ^/secret/files/ - [F]</pre>
+<pre class="prettyprint lang-config">RewriteCond "%{HTTP_USER_AGENT}" "^NameOfBadRobot"
+RewriteCond "%{REMOTE_ADDR}" "=123\.45\.67\.[8-9]"
+RewriteRule "^/secret/files/" "-" [F]</pre>
</dd>
@@ -210,10 +210,10 @@ RewriteRule ^/secret/files/ - [F]</pre>
<dd>
<pre class="prettyprint lang-config">RewriteEngine on
-RewriteMap hosts-deny txt:/path/to/hosts.deny
-RewriteCond ${hosts-deny:%{REMOTE_ADDR}|NOT-FOUND} !=NOT-FOUND [OR]
-RewriteCond ${hosts-deny:%{REMOTE_HOST}|NOT-FOUND} !=NOT-FOUND
-RewriteRule ^ - [F]</pre>
+RewriteMap hosts-deny "txt:/path/to/hosts.deny"
+RewriteCond "${hosts-deny:%{REMOTE_ADDR}|NOT-FOUND}" "!=NOT-FOUND" [OR]
+RewriteCond "${hosts-deny:%{REMOTE_HOST}|NOT-FOUND}" "!=NOT-FOUND"
+RewriteRule "^" "-" [F]</pre>
<div class="example"><p><code>
@@ -262,15 +262,15 @@ bsdti1.sdm.de -<br />
<p>The following ruleset uses a map file to associate each Referer
with a redirection target.</p>
-<pre class="prettyprint lang-config">RewriteMap deflector txt:/path/to/deflector.map
+<pre class="prettyprint lang-config">RewriteMap deflector "txt:/path/to/deflector.map"
-RewriteCond %{HTTP_REFERER} !=""
-RewriteCond ${deflector:%{HTTP_REFERER}} =-
-RewriteRule ^ %{HTTP_REFERER} [R,L]
+RewriteCond "%{HTTP_REFERER}" !=""
+RewriteCond "${deflector:%{HTTP_REFERER}}" =-
+RewriteRule "^" "%{HTTP_REFERER}" [R,L]
-RewriteCond %{HTTP_REFERER} !=""
-RewriteCond ${deflector:%{HTTP_REFERER}|NOT-FOUND} !=NOT-FOUND
-RewriteRule ^ ${deflector:%{HTTP_REFERER}} [R,L]</pre>
+RewriteCond "%{HTTP_REFERER}" !=""
+RewriteCond "${deflector:%{HTTP_REFERER}|NOT-FOUND}" "!=NOT-FOUND"
+RewriteRule "^" "${deflector:%{HTTP_REFERER}}" [R,L]</pre>
<p>The map file lists redirection targets for each referer, or, if
diff --git a/docs/manual/rewrite/access.xml b/docs/manual/rewrite/access.xml
index 0830852c60..67aa57a0d3 100644
--- a/docs/manual/rewrite/access.xml
+++ b/docs/manual/rewrite/access.xml
@@ -84,27 +84,27 @@ configuration.</note>
<!-- TODO: Add discussion here of why we have !^$ in there. -->
<highlight language="config">
-RewriteCond %{HTTP_REFERER} !^$
-RewriteCond %{HTTP_REFERER} !www.example.com [NC]
-RewriteRule \.(gif|jpg|png)$ - [F,NC]
+RewriteCond "%{HTTP_REFERER}" "!^$"
+RewriteCond "%{HTTP_REFERER}" "!www.example.com" [NC]
+RewriteRule "\.(gif|jpg|png)$" "-" [F,NC]
</highlight>
<p>In this second example, instead of failing the request, we display
an alternate image instead.</p>
<highlight language="config">
-RewriteCond %{HTTP_REFERER} !^$
-RewriteCond %{HTTP_REFERER} !www.example.com [NC]
-RewriteRule \.(gif|jpg|png)$ /images/go-away.png [R,NC]
+RewriteCond "%{HTTP_REFERER}" "!^$"
+RewriteCond "%{HTTP_REFERER}" "!www.example.com" [NC]
+RewriteRule "\.(gif|jpg|png)$" "/images/go-away.png" [R,NC]
</highlight>
<p>In the third example, we redirect the request to an image on some
other site.</p>
<highlight language="config">
-RewriteCond %{HTTP_REFERER} !^$
-RewriteCond %{HTTP_REFERER} !www.example.com [NC]
-RewriteRule \.(gif|jpg|png)$ http://other.example.com/image.gif [R,NC]
+RewriteCond "%{HTTP_REFERER}" "!^$"
+RewriteCond "%{HTTP_REFERER}" "!www.example.com" [NC]
+RewriteRule "\.(gif|jpg|png)$" "http://other.example.com/image.gif" [R,NC]
</highlight>
<p>Of these techniques, the last two tend to be the most effective
@@ -169,9 +169,9 @@ SetEnvIf Referer example\.com localreferer
particular source.</p>
<highlight language="config">
-RewriteCond %{HTTP_USER_AGENT} ^NameOfBadRobot
-RewriteCond %{REMOTE_ADDR} =123\.45\.67\.[8-9]
-RewriteRule ^/secret/files/ - [F]
+RewriteCond "%{HTTP_USER_AGENT}" "^NameOfBadRobot"
+RewriteCond "%{REMOTE_ADDR}" "=123\.45\.67\.[8-9]"
+RewriteRule "^/secret/files/" "-" [F]
</highlight>
</dd>
@@ -222,10 +222,10 @@ SetEnvIfNoCase User-Agent ^NameOfBadRobot goaway
<dd>
<highlight language="config">
RewriteEngine on
-RewriteMap hosts-deny txt:/path/to/hosts.deny
-RewriteCond ${hosts-deny:%{REMOTE_ADDR}|NOT-FOUND} !=NOT-FOUND [OR]
-RewriteCond ${hosts-deny:%{REMOTE_HOST}|NOT-FOUND} !=NOT-FOUND
-RewriteRule ^ - [F]
+RewriteMap hosts-deny "txt:/path/to/hosts.deny"
+RewriteCond "${hosts-deny:%{REMOTE_ADDR}|NOT-FOUND}" "!=NOT-FOUND" [OR]
+RewriteCond "${hosts-deny:%{REMOTE_HOST}|NOT-FOUND}" "!=NOT-FOUND"
+RewriteRule "^" "-" [F]
</highlight>
<example>
@@ -275,15 +275,15 @@ bsdti1.sdm.de -<br />
with a redirection target.</p>
<highlight language="config">
-RewriteMap deflector txt:/path/to/deflector.map
+RewriteMap deflector "txt:/path/to/deflector.map"
-RewriteCond %{HTTP_REFERER} !=""
-RewriteCond ${deflector:%{HTTP_REFERER}} =-
-RewriteRule ^ %{HTTP_REFERER} [R,L]
+RewriteCond "%{HTTP_REFERER}" !=""
+RewriteCond "${deflector:%{HTTP_REFERER}}" =-
+RewriteRule "^" "%{HTTP_REFERER}" [R,L]
-RewriteCond %{HTTP_REFERER} !=""
-RewriteCond ${deflector:%{HTTP_REFERER}|NOT-FOUND} !=NOT-FOUND
-RewriteRule ^ ${deflector:%{HTTP_REFERER}} [R,L]
+RewriteCond "%{HTTP_REFERER}" !=""
+RewriteCond "${deflector:%{HTTP_REFERER}|NOT-FOUND}" "!=NOT-FOUND"
+RewriteRule "^" "${deflector:%{HTTP_REFERER}}" [R,L]
</highlight>
<p>The map file lists redirection targets for each referer, or, if
diff --git a/docs/manual/rewrite/advanced.html.en b/docs/manual/rewrite/advanced.html.en
index 6aea5414d1..8a723de08d 100644
--- a/docs/manual/rewrite/advanced.html.en
+++ b/docs/manual/rewrite/advanced.html.en
@@ -93,8 +93,8 @@ http://physical_host_of_user1/u/user/anypath
a user has no entry in the map:</p>
<pre class="prettyprint lang-config">RewriteEngine on
-RewriteMap users-to-hosts txt:/path/to/map.users-to-hosts
-RewriteRule ^/u/([^/]+)/?(.*) http://${users-to-hosts:$1|server0}/u/$1/$2</pre>
+RewriteMap users-to-hosts "txt:/path/to/map.users-to-hosts"
+RewriteRule "^/u/([^/]+)/?(.*)" "http://${users-to-hosts:$1|server0}/u/$1/$2"</pre>
</dd>
</dl>
@@ -125,8 +125,8 @@ RewriteRule ^/u/([^/]+)/?(.*) http://${users-to-hosts:$1|server0}/u/$1/$2</p
This is done via the following ruleset:
<pre class="prettyprint lang-config"># This example is valid in per-directory context only
-RewriteCond %{REQUEST_URI} !-U
-RewriteRule ^(.+)\.html$ /regenerate_page.cgi [PT,L]</pre>
+RewriteCond "%{REQUEST_URI}" !-U
+RewriteRule "^(.+)\.html$" "/regenerate_page.cgi" [PT,L]</pre>
<p>The <code>-U</code> operator determines whether the test string
@@ -165,8 +165,8 @@ RewriteRule ^(.+)\.html$ /regenerate_page.cgi [PT,L]</pre>
to accomplish this.</p>
<pre class="prettyprint lang-config">RewriteEngine on
-RewriteMap lb rnd:/path/to/serverlist.txt
-RewriteRule ^/(.*) http://${lb:servers}/$1 [P,L]</pre>
+RewriteMap lb "rnd:/path/to/serverlist.txt"
+RewriteRule "^/(.*)" "http://${lb:servers}/$1" [P,L]</pre>
<p><code>serverlist.txt</code> will contain a list of the servers:</p>
@@ -216,7 +216,7 @@ featureful than anything you can cobble together using mod_rewrite.</p>
into the above layout.</p>
<pre class="prettyprint lang-config">RewriteEngine on
-RewriteRule ^/~(<strong>([a-z])</strong>[a-z0-9]+)(.*) /home/<strong>$2</strong>/$1/public_html$3</pre>
+RewriteRule "^/~(<strong>([a-z])</strong>[a-z0-9]+)(.*)" "/home/<strong>$2</strong>/$1/public_html$3"</pre>
</dd>
</dl>
@@ -274,10 +274,10 @@ RewriteRule ^/~(<strong>([a-z])</strong>[a-z0-9]+)(.*) /home/<strong>$2</stro
do time-dependent redirects:</p>
<pre class="prettyprint lang-config">RewriteEngine on
-RewriteCond %{TIME_HOUR}%{TIME_MIN} &gt;0700
-RewriteCond %{TIME_HOUR}%{TIME_MIN} &lt;1900
-RewriteRule ^foo\.html$ foo.day.html [L]
-RewriteRule ^foo\.html$ foo.night.html</pre>
+RewriteCond "%{TIME_HOUR}%{TIME_MIN}" &gt;0700
+RewriteCond "%{TIME_HOUR}%{TIME_MIN}" &lt;1900
+RewriteRule "^foo\.html$" "foo.day.html" [L]
+RewriteRule "^foo\.html$" "foo.night.html"</pre>
<p>This provides the content of <code>foo.day.html</code>
@@ -318,13 +318,13 @@ RewriteRule ^foo\.html$ foo.night.html</pre>
<p>Use the [E] flag to set an environment variable.</p>
<pre class="prettyprint lang-config">RewriteEngine on
-RewriteRule ^/horse/(.*) /pony/$1 [E=<strong>rewritten:1</strong>]</pre>
+RewriteRule "^/horse/(.*)" "/pony/$1" [E=<strong>rewritten:1</strong>]</pre>
<p>Later in your ruleset you might check for this environment
variable using a RewriteCond:</p>
-<pre class="prettyprint lang-config">RewriteCond %{ENV:rewritten} =1</pre>
+<pre class="prettyprint lang-config">RewriteCond "%{ENV:rewritten}" =1</pre>
<p>Note that environment variables do not survive an external
diff --git a/docs/manual/rewrite/advanced.xml b/docs/manual/rewrite/advanced.xml
index 7f1b8893d9..8abba8e109 100644
--- a/docs/manual/rewrite/advanced.xml
+++ b/docs/manual/rewrite/advanced.xml
@@ -101,8 +101,8 @@ http://physical_host_of_user1/u/user/anypath
<highlight language="config">
RewriteEngine on
-RewriteMap users-to-hosts txt:/path/to/map.users-to-hosts
-RewriteRule ^/u/([^/]+)/?(.*) http://${users-to-hosts:$1|server0}/u/$1/$2
+RewriteMap users-to-hosts "txt:/path/to/map.users-to-hosts"
+RewriteRule "^/u/([^/]+)/?(.*)" "http://${users-to-hosts:$1|server0}/u/$1/$2"
</highlight>
</dd>
</dl>
@@ -134,8 +134,8 @@ RewriteRule ^/u/([^/]+)/?(.*) http://${users-to-hosts:$1|server0}/u/$1/$2
<highlight language="config">
# This example is valid in per-directory context only
-RewriteCond %{REQUEST_URI} !-U
-RewriteRule ^(.+)\.html$ /regenerate_page.cgi [PT,L]
+RewriteCond "%{REQUEST_URI}" !-U
+RewriteRule "^(.+)\.html$" "/regenerate_page.cgi" [PT,L]
</highlight>
<p>The <code>-U</code> operator determines whether the test string
@@ -176,8 +176,8 @@ RewriteRule ^(.+)\.html$ /regenerate_page.cgi [PT,L]
<highlight language="config">
RewriteEngine on
-RewriteMap lb rnd:/path/to/serverlist.txt
-RewriteRule ^/(.*) http://${lb:servers}/$1 [P,L]
+RewriteMap lb "rnd:/path/to/serverlist.txt"
+RewriteRule "^/(.*)" "http://${lb:servers}/$1" [P,L]
</highlight>
<p><code>serverlist.txt</code> will contain a list of the servers:</p>
@@ -228,7 +228,7 @@ featureful than anything you can cobble together using mod_rewrite.</p>
<highlight language="config">
RewriteEngine on
-RewriteRule ^/~(<strong>([a-z])</strong>[a-z0-9]+)(.*) /home/<strong>$2</strong>/$1/public_html$3
+RewriteRule "^/~(<strong>([a-z])</strong>[a-z0-9]+)(.*)" "/home/<strong>$2</strong>/$1/public_html$3"
</highlight>
</dd>
</dl>
@@ -287,10 +287,10 @@ RewriteRule ^/~(<strong>([a-z])</strong>[a-z0-9]+)(.*) /home/<strong>$2</stro
<highlight language="config">
RewriteEngine on
-RewriteCond %{TIME_HOUR}%{TIME_MIN} &gt;0700
-RewriteCond %{TIME_HOUR}%{TIME_MIN} &lt;1900
-RewriteRule ^foo\.html$ foo.day.html [L]
-RewriteRule ^foo\.html$ foo.night.html
+RewriteCond "%{TIME_HOUR}%{TIME_MIN}" &gt;0700
+RewriteCond "%{TIME_HOUR}%{TIME_MIN}" &lt;1900
+RewriteRule "^foo\.html$" "foo.day.html" [L]
+RewriteRule "^foo\.html$" "foo.night.html"
</highlight>
<p>This provides the content of <code>foo.day.html</code>
@@ -332,14 +332,14 @@ RewriteRule ^foo\.html$ foo.night.html
<highlight language="config">
RewriteEngine on
-RewriteRule ^/horse/(.*) /pony/$1 [E=<strong>rewritten:1</strong>]
+RewriteRule "^/horse/(.*)" "/pony/$1" [E=<strong>rewritten:1</strong>]
</highlight>
<p>Later in your ruleset you might check for this environment
variable using a RewriteCond:</p>
<highlight language="config">
-RewriteCond %{ENV:rewritten} =1
+RewriteCond "%{ENV:rewritten}" =1
</highlight>
<p>Note that environment variables do not survive an external
diff --git a/docs/manual/rewrite/flags.html.en b/docs/manual/rewrite/flags.html.en
index e599d1df57..e0f65fc9d5 100644
--- a/docs/manual/rewrite/flags.html.en
+++ b/docs/manual/rewrite/flags.html.en
@@ -64,7 +64,7 @@ by commas.</p>
<p>Each flag (with a few exceptions) has a short form, such as
-<code>CO</code>, as well as a longer form, such as <code>cookie</code>.
+<code>CO</code>, as well as a longer form, such as <code>cookie</code>.
While it is most common to use
the short form, it is recommended that you familiarize yourself with the
long form, so that you remember what each flag is supposed to do.
@@ -82,9 +82,9 @@ of how you might use them.</p>
<h2><a name="flag_b" id="flag_b">B (escape backreferences)</a></h2>
<p>The [B] flag instructs <code class="directive"><a href="../mod/mod_rewrite.html#rewriterule">RewriteRule</a></code> to escape non-alphanumeric
characters before applying the transformation.</p>
-<p>In 2.4.10 and later, you can limit the escaping to specific characters
-in backreferences by listing them: <code>[B=#?;]</code>. Note: The space
-character can be used in the list of characters to escape, but it cannot be
+<p>In 2.4.10 and later, you can limit the escaping to specific characters
+in backreferences by listing them: <code>[B=#?;]</code>. Note: The space
+character can be used in the list of characters to escape, but it cannot be
the last character in the list.</p>
<p><code>mod_rewrite</code> has to unescape URLs before mapping them,
@@ -92,7 +92,7 @@ so backreferences are unescaped at the time they are applied.
Using the B flag, non-alphanumeric characters in backreferences
will be escaped. For example, consider the rule:</p>
-<pre class="prettyprint lang-config">RewriteRule ^search/(.*)$ /search.php?term=$1</pre>
+<pre class="prettyprint lang-config">RewriteRule "^search/(.*)$" "/search.php?term=$1"</pre>
<p>Given a search term of 'x &amp; y/z', a browser will encode it as
@@ -118,7 +118,7 @@ strings in the encoded form.</p>
<div class="section">
<h2><a name="flag_bnp" id="flag_bnp">BNP|backrefnoplus (don't escape space to +)</a></h2>
<p>The [BNP] flag instructs <code class="directive"><a href="../mod/mod_rewrite.html#rewriterule">RewriteRule</a></code> to escape the space character
-in a backreference to %20 rather than '+'. Useful when the backreference
+in a backreference to %20 rather than '+'. Useful when the backreference
will be used in the path component rather than the query string.</p>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
@@ -186,7 +186,7 @@ browsers that support this feature.</dd>
<p>Consider this example:</p>
<pre class="prettyprint lang-config">RewriteEngine On
-RewriteRule ^/index\.html - [CO=frontdoor:yes:.example.com:1440:/]</pre>
+RewriteRule "^/index\.html" "-" [CO=frontdoor:yes:.example.com:1440:/]</pre>
<p>In the example give, the rule doesn't rewrite the request.
@@ -272,15 +272,15 @@ value of '1' if the requested URI is an image file. Then, that
environment variable is used to exclude those requests from the access
log.</p>
-<pre class="prettyprint lang-config">RewriteRule \.(png|gif|jpg)$ - [E=image:1]
-CustomLog logs/access_log combined env=!image</pre>
+<pre class="prettyprint lang-config">RewriteRule "\.(png|gif|jpg)$" "-" [E=image:1]
+CustomLog logs/access_log combined env=!image</pre>
<p>Note that this same effect can be obtained using <code class="directive"><a href="../mod/mod_setenvif.html#setenvif">SetEnvIf</a></code>. This technique is offered as
an example, not as a recommendation.</p>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
-<h2><a name="flag_end" id="flag_end">END</a></h2>
+<h2><a name="flag_end" id="flag_end">END</a></h2>
<p>Using the [END] flag terminates not only the current round of rewrite
processing (like [L]) but also prevents any subsequent rewrite
processing from occurring in per-directory (htaccess) context.</p>
@@ -298,7 +298,7 @@ allows more flexibility in assigning a Forbidden status.</p>
<p>The following rule will forbid <code>.exe</code> files from being
downloaded from your server.</p>
-<pre class="prettyprint lang-config">RewriteRule \.exe - [F]</pre>
+<pre class="prettyprint lang-config">RewriteRule "\.exe" "-" [F]</pre>
<p>This example uses the "-" syntax for the rewrite target, which means
@@ -318,7 +318,7 @@ longer available.</p>
<p>As with the [F] flag, you will typically use the "-" syntax for the
rewrite target when using the [G] flag:</p>
-<pre class="prettyprint lang-config">RewriteRule oldproduct - [G,NC]</pre>
+<pre class="prettyprint lang-config">RewriteRule "oldproduct" "-" [G,NC]</pre>
<p>When using [G], an [L] is implied - that is, the response is returned
@@ -331,7 +331,7 @@ immediately, and no further rules are evaluated.</p>
handler. For example, one might use this to force all files without a
file extension to be parsed by the php handler:</p>
-<pre class="prettyprint lang-config">RewriteRule !\. - [H=application/x-httpd-php]</pre>
+<pre class="prettyprint lang-config">RewriteRule "!\." "-" [H=application/x-httpd-php]</pre>
<p>
@@ -344,7 +344,7 @@ For example, the following snippet used in per-server context allows
<code>.php</code> files to be <em>displayed</em> by <code>mod_php</code>
if they are requested with the <code>.phps</code> extension:</p>
-<pre class="prettyprint lang-config">RewriteRule ^(/source/.+\.php)s$ $1 [H=application/x-httpd-php-source]</pre>
+<pre class="prettyprint lang-config">RewriteRule "^(/source/.+\.php)s$" "$1" [H=application/x-httpd-php-source]</pre>
<p>The regular expression above - <code>^(/source/.+\.php)s$</code> - will
@@ -392,9 +392,9 @@ redirects.</p>
argument to <code>index.php</code>, however, the <code class="directive"><a href="../mod/mod_rewrite.html#rewritecond">RewriteCond</a></code> ensures that if the request
is already for <code>index.php</code>, the <code class="directive"><a href="../mod/mod_rewrite.html#rewriterule">RewriteRule</a></code> will be skipped.</p>
-<pre class="prettyprint lang-config">RewriteBase /
-RewriteCond %{REQUEST_URI} !=/index.php
-RewriteRule ^(.*) /index.php?req=$1 [L,PT]</pre>
+<pre class="prettyprint lang-config">RewriteBase "/"
+RewriteCond "%{REQUEST_URI}" !=/index.php
+RewriteRule "^(.*)" "/index.php?req=$1" [L,PT]</pre>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
@@ -410,7 +410,7 @@ certain string or letter repeatedly in a request. The example shown here
will replace A with B everywhere in a request, and will continue doing
so until there are no more As to be replaced.
</p>
-<pre class="prettyprint lang-config">RewriteRule (.*)A(.*) $1B$2 [N]</pre>
+<pre class="prettyprint lang-config">RewriteRule "(.*)A(.*)" "$1B$2" [N]</pre>
<p>You can think of this as a <code>while</code> loop: While this
pattern still matches (i.e., while the URI still contains an
@@ -418,12 +418,12 @@ pattern still matches (i.e., while the URI still contains an
<code>A</code> with a <code>B</code>).</p>
<p>In 2.5.0 and later, this module returns an error after 10,000 iterations to
-protect against unintended looping. An alternative maximum number of
+protect against unintended looping. An alternative maximum number of
iterations can be specified by adding to the N flag. </p>
<pre class="prettyprint lang-config"># Be willing to replace 1 character in each pass of the loop
-RewriteRule (.+)[&gt;&lt;;]$ $1 [N=32000]
+RewriteRule "(.+)[&gt;&lt;;]$" "$1" [N=32000]
# ... or, give up if after 10 loops
-RewriteRule (.+)[&gt;&lt;;]$ $1 [N=10]</pre>
+RewriteRule "(.+)[&gt;&lt;;]$" "$1" [N=10]</pre>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
@@ -438,7 +438,7 @@ to your dedicated image server. The match is case-insensitive, so that
<code>.jpg</code> and <code>.JPG</code> files are both acceptable, for
example.</p>
-<pre class="prettyprint lang-config">RewriteRule (.*\.(jpg|gif|png))$ http://images.example.com$1 [P,NC]</pre>
+<pre class="prettyprint lang-config">RewriteRule "(.*\.(jpg|gif|png))$" "http://images.example.com$1" [P,NC]</pre>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
@@ -448,7 +448,7 @@ example.</p>
equivalent. Using the [NE] flag prevents that from happening.
</p>
-<pre class="prettyprint lang-config">RewriteRule ^/anchor/(.+) /bigpage.html#$1 [NE,R]</pre>
+<pre class="prettyprint lang-config">RewriteRule "^/anchor/(.+)" "/bigpage.html#$1" [NE,R]</pre>
<p>
@@ -490,7 +490,7 @@ requests.
example, if you wanted all image requests to be handled by a back-end
image server, you might do something like the following:</p>
-<pre class="prettyprint lang-config">RewriteRule /(.*)\.(jpg|gif|png)$ http://images.example.com/$1.$2 [P]</pre>
+<pre class="prettyprint lang-config">RewriteRule "/(.*)\.(jpg|gif|png)$" "http://images.example.com/$1.$2" [P]</pre>
<p>Use of the [P] flag implies [L] - that is, the request is immediately
@@ -548,7 +548,7 @@ use the [PT] flag to ensure that the
</p>
<pre class="prettyprint lang-config">Alias "/icons" "/usr/local/apache/icons"
-RewriteRule /pics/(.+)\.jpg$ /icons/$1.gif [PT]</pre>
+RewriteRule "/pics/(.+)\.jpg$" "/icons/$1.gif" [PT]</pre>
<p>
@@ -578,7 +578,7 @@ Using the [QSA] flag causes the query strings to be combined.
<p>Consider the following rule:</p>
-<pre class="prettyprint lang-config">RewriteRule /pages/(.+) /page.php?page=$1 [QSA]</pre>
+<pre class="prettyprint lang-config">RewriteRule "/pages/(.+)" "/page.php?page=$1" [QSA]</pre>
<p>With the [QSA] flag, a request for <code>/pages/123?one=two</code> will be
@@ -625,7 +625,7 @@ will be used to generate the URL sent with the redirect.
<em>Any</em> valid HTTP response status code may be specified,
using the syntax [R=305], with a 302 status code being used by
default if none is specified. The status code specified need not
-necessarily be a redirect (3xx) status code. However,
+necessarily be a redirect (3xx) status code. However,
if a status code is outside the redirect range (300-399) then the
substitution string is dropped entirely, and rewriting is stopped as if
the <code>L</code> were used.</p>
@@ -645,24 +645,24 @@ URI in request' warnings.
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
<h2><a name="flag_s" id="flag_s">S|skip</a></h2>
-<p>The [S] flag is used to skip rules that you don't want to run. The
-syntax of the skip flag is [S=<em>N</em>], where <em>N</em> signifies
+<p>The [S] flag is used to skip rules that you don't want to run. The
+syntax of the skip flag is [S=<em>N</em>], where <em>N</em> signifies
the number of rules to skip (provided the <code class="directive"><a href="../mod/mod_rewrite.html#rewriterule">
RewriteRule</a></code> and any preceding <code class="directive"><a href="../mod/mod_rewrite.html#rewritecond">
-RewriteCond</a></code> directives match). This can be thought of as a
-<code>goto</code> statement in your rewrite ruleset. In the following
+RewriteCond</a></code> directives match). This can be thought of as a
+<code>goto</code> statement in your rewrite ruleset. In the following
example, we only want to run the <code class="directive"><a href="../mod/mod_rewrite.html#rewriterule">
-RewriteRule</a></code> if the requested URI doesn't correspond with an
+RewriteRule</a></code> if the requested URI doesn't correspond with an
actual file.</p>
<pre class="prettyprint lang-config"># Is the request for a non-existent file?
-RewriteCond %{REQUEST_FILENAME} !-f
-RewriteCond %{REQUEST_FILENAME} !-d
+RewriteCond "%{REQUEST_FILENAME}" !-f
+RewriteCond "%{REQUEST_FILENAME}" !-d
# If so, skip these two RewriteRules
-RewriteRule .? - [S=2]
+RewriteRule ".?" "-" [S=2]
-RewriteRule (.*\.gif) images.php?$1
-RewriteRule (.*\.html) docs.php?$1</pre>
+RewriteRule "(.*\.gif)" "images.php?$1"
+RewriteRule "(.*\.html)" "docs.php?$1"</pre>
<p>This technique is useful because a <code class="directive"><a href="../mod/mod_rewrite.html#rewritecond">RewriteCond</a></code> only applies to the
@@ -674,18 +674,18 @@ use this to make pseudo if-then-else constructs: The last rule of
the then-clause becomes <code>skip=N</code>, where N is the
number of rules in the else-clause:</p>
<pre class="prettyprint lang-config"># Does the file exist?
-RewriteCond %{REQUEST_FILENAME} !-f
-RewriteCond %{REQUEST_FILENAME} !-d
+RewriteCond "%{REQUEST_FILENAME}" !-f
+RewriteCond "%{REQUEST_FILENAME}" !-d
# Create an if-then-else construct by skipping 3 lines if we meant to go to the "else" stanza.
-RewriteRule .? - [S=3]
+RewriteRule ".?" "-" [S=3]
# IF the file exists, then:
- RewriteRule (.*\.gif) images.php?$1
- RewriteRule (.*\.html) docs.php?$1
+ RewriteRule "(.*\.gif)" "images.php?$1"
+ RewriteRule "(.*\.html)" "docs.php?$1"
# Skip past the "else" stanza.
- RewriteRule .? - [S=1]
+ RewriteRule ".?" "-" [S=1]
# ELSE...
- RewriteRule (.*) 404.php?file=$1
+ RewriteRule "(.*)" "404.php?file=$1"
# END</pre>
@@ -702,7 +702,7 @@ sent. This has the same effect as the <code class="directive"><a href="../mod/mo
source code as plain text, if requested in a particular way:</p>
<pre class="prettyprint lang-config"># Serve .pl files as plain text
-RewriteRule \.pl$ - [T=text/plain]</pre>
+RewriteRule "\.pl$" "-" [T=text/plain]</pre>
<p>Or, perhaps, if you have a camera that produces jpeg images without
@@ -710,7 +710,7 @@ file extensions, you could force those images to be served with the
correct MIME type by virtue of their file names:</p>
<pre class="prettyprint lang-config"># Files with 'IMG' in the name are jpg images.
-RewriteRule IMG - [T=image/jpg]</pre>
+RewriteRule "IMG" "-" [T=image/jpg]</pre>
<p>Please note that this is a trivial example, and could be better done
diff --git a/docs/manual/rewrite/flags.xml b/docs/manual/rewrite/flags.xml
index b12cad3d3b..b3bccb2584 100644
--- a/docs/manual/rewrite/flags.xml
+++ b/docs/manual/rewrite/flags.xml
@@ -81,7 +81,7 @@ Using the B flag, non-alphanumeric characters in backreferences
will be escaped. For example, consider the rule:</p>
<highlight language="config">
-RewriteRule ^search/(.*)$ /search.php?term=$1
+RewriteRule "^search/(.*)$" "/search.php?term=$1"
</highlight>
<p>Given a search term of 'x &amp; y/z', a browser will encode it as
@@ -180,7 +180,7 @@ browsers that support this feature.</dd>
<highlight language="config">
RewriteEngine On
-RewriteRule ^/index\.html - [CO=frontdoor:yes:.example.com:1440:/]
+RewriteRule "^/index\.html" "-" [CO=frontdoor:yes:.example.com:1440:/]
</highlight>
<p>In the example give, the rule doesn't rewrite the request.
@@ -267,8 +267,8 @@ environment variable is used to exclude those requests from the access
log.</p>
<highlight language="config">
-RewriteRule \.(png|gif|jpg)$ - [E=image:1]
-CustomLog logs/access_log combined env=!image
+RewriteRule "\.(png|gif|jpg)$" "-" [E=image:1]
+CustomLog logs/access_log combined env=!image
</highlight>
<p>Note that this same effect can be obtained using <directive
@@ -295,7 +295,7 @@ allows more flexibility in assigning a Forbidden status.</p>
downloaded from your server.</p>
<highlight language="config">
-RewriteRule \.exe - [F]
+RewriteRule "\.exe" "-" [F]
</highlight>
<p>This example uses the "-" syntax for the rewrite target, which means
@@ -316,7 +316,7 @@ longer available.</p>
rewrite target when using the [G] flag:</p>
<highlight language="config">
-RewriteRule oldproduct - [G,NC]
+RewriteRule "oldproduct" "-" [G,NC]
</highlight>
<p>When using [G], an [L] is implied - that is, the response is returned
@@ -330,7 +330,7 @@ handler. For example, one might use this to force all files without a
file extension to be parsed by the php handler:</p>
<highlight language="config">
-RewriteRule !\. - [H=application/x-httpd-php]
+RewriteRule "!\." "-" [H=application/x-httpd-php]
</highlight>
<p>
@@ -344,7 +344,7 @@ For example, the following snippet used in per-server context allows
if they are requested with the <code>.phps</code> extension:</p>
<highlight language="config">
-RewriteRule ^(/source/.+\.php)s$ $1 [H=application/x-httpd-php-source]
+RewriteRule "^(/source/.+\.php)s$" "$1" [H=application/x-httpd-php-source]
</highlight>
<p>The regular expression above - <code>^(/source/.+\.php)s$</code> - will
@@ -397,9 +397,9 @@ is already for <code>index.php</code>, the <directive
module="mod_rewrite">RewriteRule</directive> will be skipped.</p>
<highlight language="config">
-RewriteBase /
-RewriteCond %{REQUEST_URI} !=/index.php
-RewriteRule ^(.*) /index.php?req=$1 [L,PT]
+RewriteBase "/"
+RewriteCond "%{REQUEST_URI}" !=/index.php
+RewriteRule "^(.*)" "/index.php?req=$1" [L,PT]
</highlight>
</section>
@@ -416,7 +416,7 @@ will replace A with B everywhere in a request, and will continue doing
so until there are no more As to be replaced.
</p>
<highlight language="config">
-RewriteRule (.*)A(.*) $1B$2 [N]
+RewriteRule "(.*)A(.*)" "$1B$2" [N]
</highlight>
<p>You can think of this as a <code>while</code> loop: While this
pattern still matches (i.e., while the URI still contains an
@@ -428,9 +428,9 @@ protect against unintended looping. An alternative maximum number of
iterations can be specified by adding to the N flag. </p>
<highlight language="config">
# Be willing to replace 1 character in each pass of the loop
-RewriteRule (.+)[&gt;&lt;;]$ $1 [N=32000]
+RewriteRule "(.+)[&gt;&lt;;]$" "$1" [N=32000]
# ... or, give up if after 10 loops
-RewriteRule (.+)[&gt;&lt;;]$ $1 [N=10]
+RewriteRule "(.+)[&gt;&lt;;]$" "$1" [N=10]
</highlight>
</section>
@@ -447,7 +447,7 @@ to your dedicated image server. The match is case-insensitive, so that
example.</p>
<highlight language="config">
-RewriteRule (.*\.(jpg|gif|png))$ http://images.example.com$1 [P,NC]
+RewriteRule "(.*\.(jpg|gif|png))$" "http://images.example.com$1" [P,NC]
</highlight>
</section>
@@ -458,7 +458,7 @@ equivalent. Using the [NE] flag prevents that from happening.
</p>
<highlight language="config">
-RewriteRule ^/anchor/(.+) /bigpage.html#$1 [NE,R]
+RewriteRule "^/anchor/(.+)" "/bigpage.html#$1" [NE,R]
</highlight>
<p>
@@ -501,7 +501,7 @@ example, if you wanted all image requests to be handled by a back-end
image server, you might do something like the following:</p>
<highlight language="config">
-RewriteRule /(.*)\.(jpg|gif|png)$ http://images.example.com/$1.$2 [P]
+RewriteRule "/(.*)\.(jpg|gif|png)$" "http://images.example.com/$1.$2" [P]
</highlight>
<p>Use of the [P] flag implies [L] - that is, the request is immediately
@@ -566,7 +566,7 @@ use the [PT] flag to ensure that the
<highlight language="config">
Alias "/icons" "/usr/local/apache/icons"
-RewriteRule /pics/(.+)\.jpg$ /icons/$1.gif [PT]
+RewriteRule "/pics/(.+)\.jpg$" "/icons/$1.gif" [PT]
</highlight>
<p>
@@ -597,7 +597,7 @@ Using the [QSA] flag causes the query strings to be combined.
<p>Consider the following rule:</p>
<highlight language="config">
-RewriteRule /pages/(.+) /page.php?page=$1 [QSA]
+RewriteRule "/pages/(.+)" "/page.php?page=$1" [QSA]
</highlight>
<p>With the [QSA] flag, a request for <code>/pages/123?one=two</code> will be
@@ -677,13 +677,13 @@ actual file.</p>
<highlight language="config">
# Is the request for a non-existent file?
-RewriteCond %{REQUEST_FILENAME} !-f
-RewriteCond %{REQUEST_FILENAME} !-d
+RewriteCond "%{REQUEST_FILENAME}" !-f
+RewriteCond "%{REQUEST_FILENAME}" !-d
# If so, skip these two RewriteRules
-RewriteRule .? - [S=2]
+RewriteRule ".?" "-" [S=2]
-RewriteRule (.*\.gif) images.php?$1
-RewriteRule (.*\.html) docs.php?$1
+RewriteRule "(.*\.gif)" "images.php?$1"
+RewriteRule "(.*\.html)" "docs.php?$1"
</highlight>
<p>This technique is useful because a <directive
@@ -697,18 +697,18 @@ the then-clause becomes <code>skip=N</code>, where N is the
number of rules in the else-clause:</p>
<highlight language="config">
# Does the file exist?
-RewriteCond %{REQUEST_FILENAME} !-f
-RewriteCond %{REQUEST_FILENAME} !-d
+RewriteCond "%{REQUEST_FILENAME}" !-f
+RewriteCond "%{REQUEST_FILENAME}" !-d
# Create an if-then-else construct by skipping 3 lines if we meant to go to the &quot;else&quot; stanza.
-RewriteRule .? - [S=3]
+RewriteRule ".?" "-" [S=3]
# IF the file exists, then:
- RewriteRule (.*\.gif) images.php?$1
- RewriteRule (.*\.html) docs.php?$1
+ RewriteRule "(.*\.gif)" "images.php?$1"
+ RewriteRule "(.*\.html)" "docs.php?$1"
# Skip past the &quot;else&quot; stanza.
- RewriteRule .? - [S=1]
+ RewriteRule ".?" "-" [S=1]
# ELSE...
- RewriteRule (.*) 404.php?file=$1
+ RewriteRule "(.*)" "404.php?file=$1"
# END
</highlight>
@@ -729,7 +729,7 @@ source code as plain text, if requested in a particular way:</p>
<highlight language="config">
# Serve .pl files as plain text
-RewriteRule \.pl$ - [T=text/plain]
+RewriteRule "\.pl$" "-" [T=text/plain]
</highlight>
<p>Or, perhaps, if you have a camera that produces jpeg images without
@@ -738,7 +738,7 @@ correct MIME type by virtue of their file names:</p>
<highlight language="config">
# Files with 'IMG' in the name are jpg images.
-RewriteRule IMG - [T=image/jpg]
+RewriteRule "IMG" "-" [T=image/jpg]
</highlight>
<p>Please note that this is a trivial example, and could be better done
diff --git a/docs/manual/rewrite/flags.xml.fr b/docs/manual/rewrite/flags.xml.fr
index b7a5457047..6144a16c7c 100644
--- a/docs/manual/rewrite/flags.xml.fr
+++ b/docs/manual/rewrite/flags.xml.fr
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE manualpage SYSTEM "../style/manualpage.dtd">
<?xml-stylesheet type="text/xsl" href="../style/manual.fr.xsl"?>
-<!-- English Revision: 1585159:1673908 (outdated) -->
+<!-- English Revision: 1585159:1673932 (outdated) -->
<!-- French translation : Lucien GENTIS -->
<!-- Reviewed by : Vincent Deffontaines -->
diff --git a/docs/manual/rewrite/index.xml b/docs/manual/rewrite/index.xml
index 548d88cc1b..181e05df96 100644
--- a/docs/manual/rewrite/index.xml
+++ b/docs/manual/rewrite/index.xml
@@ -87,5 +87,3 @@ wiki</a></seealso>
</manualpage>
-
-
diff --git a/docs/manual/rewrite/intro.html.en b/docs/manual/rewrite/intro.html.en
index 915d8e17ad..6a293058d3 100644
--- a/docs/manual/rewrite/intro.html.en
+++ b/docs/manual/rewrite/intro.html.en
@@ -141,21 +141,21 @@ the expression.</p>
<em>CondPattern</em>, back-references are internally created
which can be used with the strings <code>$N</code> and
<code>%N</code> (see below). These are available for creating
- the <em>Substitution</em> parameter of a
+ the <em>Substitution</em> parameter of a
<code class="directive"><a href="../mod/mod_rewrite.html#rewriterule">RewriteRule</a></code> or
- the <em>TestString</em> parameter of a
+ the <em>TestString</em> parameter of a
<code class="directive"><a href="../mod/mod_rewrite.html#rewritecond">RewriteCond</a></code>.</p>
- <p> Captures in the <code class="directive"><a href="../mod/mod_rewrite.html#rewriterule">RewriteRule</a></code> patterns are (counterintuitively) available to
- all preceding
+ <p> Captures in the <code class="directive"><a href="../mod/mod_rewrite.html#rewriterule">RewriteRule</a></code> patterns are (counterintuitively) available to
+ all preceding
<code class="directive"><a href="../mod/mod_rewrite.html#rewritecond">RewriteCond</a></code> directives,
because the <code class="directive"><a href="../mod/mod_rewrite.html#rewriterule">RewriteRule</a></code>
expression is evaluated before the individual conditions.</p>
- <p>Figure 1 shows to which
- locations the back-references are transferred for expansion as
- well as illustrating the flow of the RewriteRule, RewriteCond
- matching. In the next chapters, we will be exploring how to use
- these back-references, so do not fret if it seems a bit alien
+ <p>Figure 1 shows to which
+ locations the back-references are transferred for expansion as
+ well as illustrating the flow of the RewriteRule, RewriteCond
+ matching. In the next chapters, we will be exploring how to use
+ these back-references, so do not fret if it seems a bit alien
to you at first.
</p>
@@ -177,12 +177,12 @@ of three arguments separated by spaces. The arguments are</p>
<li><var>[flags]</var>: options affecting the rewritten request.</li>
</ol>
-<p>The <var>Pattern</var> is a <a href="#regex">regular expression</a>.
-It is initially (for the first rewrite rule or until a substitution occurs)
-matched against the URL-path of the incoming request (the part after the
-hostname but before any question mark indicating the beginning of a query
-string) or, in per-directory context, against the request's path relative
-to the directory for which the rule is defined. Once a substitution has
+<p>The <var>Pattern</var> is a <a href="#regex">regular expression</a>.
+It is initially (for the first rewrite rule or until a substitution occurs)
+matched against the URL-path of the incoming request (the part after the
+hostname but before any question mark indicating the beginning of a query
+string) or, in per-directory context, against the request's path relative
+to the directory for which the rule is defined. Once a substitution has
occurred, the rules that follow are matched against the substituted
value.
</p>
@@ -198,7 +198,7 @@ value.
<dl>
<dt>A full filesystem path to a resource</dt>
<dd>
-<pre class="prettyprint lang-config">RewriteRule ^/games /usr/local/games/web</pre>
+<pre class="prettyprint lang-config">RewriteRule "^/games" "/usr/local/games/web"</pre>
<p>This maps a request to an arbitrary location on your filesystem, much
like the <code class="directive"><a href="../mod/mod_alias.html#alias">Alias</a></code> directive.</p>
@@ -206,7 +206,7 @@ like the <code class="directive"><a href="../mod/mod_alias.html#alias">Alias</a>
<dt>A web-path to a resource</dt>
<dd>
-<pre class="prettyprint lang-config">RewriteRule ^/foo$ /bar</pre>
+<pre class="prettyprint lang-config">RewriteRule "^/foo$" "/bar"</pre>
<p>If <code class="directive"><a href="../mod/core.html#documentroot">DocumentRoot</a></code> is set
to <code>/usr/local/apache2/htdocs</code>, then this directive would
@@ -216,7 +216,7 @@ path <code>/usr/local/apache2/htdocs/bar</code>.</p>
<dt>An absolute URL</dt>
<dd>
-<pre class="prettyprint lang-config">RewriteRule ^/product/view$ http://site2.example.com/seeproduct.html [R]</pre>
+<pre class="prettyprint lang-config">RewriteRule "^/product/view$" "http://site2.example.com/seeproduct.html" [R]</pre>
<p>This tells the client to make a new request for the specified URL.</p>
</dd>
@@ -225,7 +225,7 @@ path <code>/usr/local/apache2/htdocs/bar</code>.</p>
<p>The <var>Substitution</var> can also
contain <em>back-references</em> to parts of the incoming URL-path
matched by the <var>Pattern</var>. Consider the following:</p>
-<pre class="prettyprint lang-config">RewriteRule ^/product/(.*)/view$ /var/web/productdb/$1</pre>
+<pre class="prettyprint lang-config">RewriteRule "^/product/(.*)/view$" "/var/web/productdb/$1"</pre>
<p>The variable <code>$1</code> will be replaced with whatever text
was matched by the expression inside the parenthesis in
@@ -247,7 +247,7 @@ application of one or more flags to the end of the rule. For example, the
matching behavior of a rule can be made case-insensitive by the
application of the <code>[NC]</code> flag:
</p>
-<pre class="prettyprint lang-config">RewriteRule ^puppy.html smalldog.html [NC]</pre>
+<pre class="prettyprint lang-config">RewriteRule "^puppy.html" "smalldog.html" [NC]</pre>
<p>For more details on the available flags, their meanings, and
@@ -272,8 +272,8 @@ argument is a list of flags that modify how the match is evaluated.</p>
<p>For example, to send all requests from a particular IP range to a
different server, you could use:</p>
-<pre class="prettyprint lang-config">RewriteCond %{REMOTE_ADDR} ^10\.2\.
-RewriteRule (.*) http://intranet.example.com$1</pre>
+<pre class="prettyprint lang-config">RewriteCond "%{REMOTE_ADDR}" "^10\.2\."
+RewriteRule "(.*)" "http://intranet.example.com$1"</pre>
<p>When more than
@@ -283,9 +283,9 @@ the <code class="directive"><a href="../mod/mod_rewrite.html#rewriterule">Rewrit
applied. For example, to deny requests that contain the word "hack" in
their query string, unless they also contain a cookie containing
the word "go", you could use:</p>
-<pre class="prettyprint lang-config">RewriteCond %{QUERY_STRING} hack
-RewriteCond %{HTTP_COOKIE} !go
-RewriteRule . - [F]</pre>
+<pre class="prettyprint lang-config">RewriteCond "%{QUERY_STRING}" "hack"
+RewriteCond "%{HTTP_COOKIE}" !go
+RewriteRule "." "-" [F]</pre>
<p>Notice that the exclamation mark specifies a negative match, so the rule is only applied if the cookie does not contain "go".</p>
@@ -296,8 +296,8 @@ the <code class="directive"><a href="../mod/mod_rewrite.html#rewriterule">Rewrit
variables <code>%1</code>, <code>%2</code>, etc. For example, this
will direct the request to a different directory depending on the
hostname used to access the site:</p>
-<pre class="prettyprint lang-config">RewriteCond %{HTTP_HOST} (.*)
-RewriteRule ^/(.*) /sites/%1/$1</pre>
+<pre class="prettyprint lang-config">RewriteCond "%{HTTP_HOST}" "(.*)"
+RewriteRule "^/(.*)" "/sites/%1/$1"</pre>
<p>If the request was for <code>http://example.com/foo/bar</code>,
then <code>%1</code> would contain <code>example.com</code>
diff --git a/docs/manual/rewrite/intro.xml b/docs/manual/rewrite/intro.xml
index 798bd00e93..52cdb3dcc9 100644
--- a/docs/manual/rewrite/intro.xml
+++ b/docs/manual/rewrite/intro.xml
@@ -145,22 +145,22 @@ the expression.</p>
<em>CondPattern</em>, back-references are internally created
which can be used with the strings <code>$N</code> and
<code>%N</code> (see below). These are available for creating
- the <em>Substitution</em> parameter of a
+ the <em>Substitution</em> parameter of a
<directive module="mod_rewrite">RewriteRule</directive> or
- the <em>TestString</em> parameter of a
+ the <em>TestString</em> parameter of a
<directive module="mod_rewrite">RewriteCond</directive>.</p>
<p> Captures in the <directive module="mod_rewrite"
- >RewriteRule</directive> patterns are (counterintuitively) available to
- all preceding
+ >RewriteRule</directive> patterns are (counterintuitively) available to
+ all preceding
<directive module="mod_rewrite">RewriteCond</directive> directives,
because the <directive module="mod_rewrite">RewriteRule</directive>
expression is evaluated before the individual conditions.</p>
- <p>Figure 1 shows to which
- locations the back-references are transferred for expansion as
- well as illustrating the flow of the RewriteRule, RewriteCond
- matching. In the next chapters, we will be exploring how to use
- these back-references, so do not fret if it seems a bit alien
+ <p>Figure 1 shows to which
+ locations the back-references are transferred for expansion as
+ well as illustrating the flow of the RewriteRule, RewriteCond
+ matching. In the next chapters, we will be exploring how to use
+ these back-references, so do not fret if it seems a bit alien
to you at first.
</p>
@@ -183,12 +183,12 @@ of three arguments separated by spaces. The arguments are</p>
<li><var>[flags]</var>: options affecting the rewritten request.</li>
</ol>
-<p>The <var>Pattern</var> is a <a href="#regex">regular expression</a>.
-It is initially (for the first rewrite rule or until a substitution occurs)
-matched against the URL-path of the incoming request (the part after the
-hostname but before any question mark indicating the beginning of a query
-string) or, in per-directory context, against the request's path relative
-to the directory for which the rule is defined. Once a substitution has
+<p>The <var>Pattern</var> is a <a href="#regex">regular expression</a>.
+It is initially (for the first rewrite rule or until a substitution occurs)
+matched against the URL-path of the incoming request (the part after the
+hostname but before any question mark indicating the beginning of a query
+string) or, in per-directory context, against the request's path relative
+to the directory for which the rule is defined. Once a substitution has
occurred, the rules that follow are matched against the substituted
value.
</p>
@@ -206,7 +206,7 @@ value.
<dt>A full filesystem path to a resource</dt>
<dd>
<highlight language="config">
-RewriteRule ^/games /usr/local/games/web
+RewriteRule "^/games" "/usr/local/games/web"
</highlight>
<p>This maps a request to an arbitrary location on your filesystem, much
like the <directive module="mod_alias">Alias</directive> directive.</p>
@@ -215,7 +215,7 @@ like the <directive module="mod_alias">Alias</directive> directive.</p>
<dt>A web-path to a resource</dt>
<dd>
<highlight language="config">
-RewriteRule ^/foo$ /bar
+RewriteRule "^/foo$" "/bar"
</highlight>
<p>If <directive module="core">DocumentRoot</directive> is set
to <code>/usr/local/apache2/htdocs</code>, then this directive would
@@ -226,7 +226,7 @@ path <code>/usr/local/apache2/htdocs/bar</code>.</p>
<dt>An absolute URL</dt>
<dd>
<highlight language="config">
-RewriteRule ^/product/view$ http://site2.example.com/seeproduct.html [R]
+RewriteRule "^/product/view$" "http://site2.example.com/seeproduct.html" [R]
</highlight>
<p>This tells the client to make a new request for the specified URL.</p>
</dd>
@@ -236,7 +236,7 @@ RewriteRule ^/product/view$ http://site2.example.com/seeproduct.html [R]
contain <em>back-references</em> to parts of the incoming URL-path
matched by the <var>Pattern</var>. Consider the following:</p>
<highlight language="config">
-RewriteRule ^/product/(.*)/view$ /var/web/productdb/$1
+RewriteRule "^/product/(.*)/view$" "/var/web/productdb/$1"
</highlight>
<p>The variable <code>$1</code> will be replaced with whatever text
was matched by the expression inside the parenthesis in
@@ -260,7 +260,7 @@ matching behavior of a rule can be made case-insensitive by the
application of the <code>[NC]</code> flag:
</p>
<highlight language="config">
-RewriteRule ^puppy.html smalldog.html [NC]
+RewriteRule "^puppy.html" "smalldog.html" [NC]
</highlight>
<p>For more details on the available flags, their meanings, and
@@ -288,8 +288,8 @@ argument is a list of flags that modify how the match is evaluated.</p>
<p>For example, to send all requests from a particular IP range to a
different server, you could use:</p>
<highlight language="config">
-RewriteCond %{REMOTE_ADDR} ^10\.2\.
-RewriteRule (.*) http://intranet.example.com$1
+RewriteCond "%{REMOTE_ADDR}" "^10\.2\."
+RewriteRule "(.*)" "http://intranet.example.com$1"
</highlight>
<p>When more than
@@ -300,9 +300,9 @@ applied. For example, to deny requests that contain the word "hack" in
their query string, unless they also contain a cookie containing
the word "go", you could use:</p>
<highlight language="config">
-RewriteCond %{QUERY_STRING} hack
-RewriteCond %{HTTP_COOKIE} !go
-RewriteRule . - [F]
+RewriteCond "%{QUERY_STRING}" "hack"
+RewriteCond "%{HTTP_COOKIE}" !go
+RewriteRule "." "-" [F]
</highlight>
<p>Notice that the exclamation mark specifies a negative match, so the rule is only applied if the cookie does not contain "go".</p>
@@ -314,8 +314,8 @@ variables <code>%1</code>, <code>%2</code>, etc. For example, this
will direct the request to a different directory depending on the
hostname used to access the site:</p>
<highlight language="config">
-RewriteCond %{HTTP_HOST} (.*)
-RewriteRule ^/(.*) /sites/%1/$1
+RewriteCond "%{HTTP_HOST}" "(.*)"
+RewriteRule "^/(.*)" "/sites/%1/$1"
</highlight>
<p>If the request was for <code>http://example.com/foo/bar</code>,
then <code>%1</code> would contain <code>example.com</code>
@@ -354,5 +354,3 @@ the <directive module="mod_rewrite">RewriteRule</directive>. In addition, the <d
</section>
</manualpage>
-
-
diff --git a/docs/manual/rewrite/proxy.html.en b/docs/manual/rewrite/proxy.html.en
index 6c7e08d009..fca4afcf0d 100644
--- a/docs/manual/rewrite/proxy.html.en
+++ b/docs/manual/rewrite/proxy.html.en
@@ -57,8 +57,8 @@ A number of recipes are provided that describe common scenarios.</p>
follows:</p>
<pre class="prettyprint lang-config">RewriteEngine on
-RewriteBase /products/
-RewriteRule ^widget/(.*)$ http://product.example.com/widget/$1 [P]
+RewriteBase "/products/"
+RewriteRule "^widget/(.*)$" "http://product.example.com/widget/$1" [P]
ProxyPassReverse "/products/widget/" "http://product.example.com/widget/"</pre>
@@ -67,9 +67,9 @@ ProxyPassReverse "/products/widget/" "http://product.example.com/widget/"</pre>
from one server to another, and you're not sure if all the content
has been migrated yet.</p>
-<pre class="prettyprint lang-config">RewriteCond %{REQUEST_FILENAME} !-f
-RewriteCond %{REQUEST_FILENAME} !-d
-RewriteRule ^/(.*) http://old.example.com/$1 [P]
+<pre class="prettyprint lang-config">RewriteCond "%{REQUEST_FILENAME}" !-f
+RewriteCond "%{REQUEST_FILENAME}" !-d
+RewriteRule "^/(.*)" "http://old.example.com/$1" [P]
ProxyPassReverse "/" "http://old.example.com/"</pre>
</dd>
diff --git a/docs/manual/rewrite/proxy.xml b/docs/manual/rewrite/proxy.xml
index 448a5e68c5..8a255e891d 100644
--- a/docs/manual/rewrite/proxy.xml
+++ b/docs/manual/rewrite/proxy.xml
@@ -67,8 +67,8 @@ A number of recipes are provided that describe common scenarios.</p>
<highlight language="config">
RewriteEngine on
-RewriteBase /products/
-RewriteRule ^widget/(.*)$ http://product.example.com/widget/$1 [P]
+RewriteBase "/products/"
+RewriteRule "^widget/(.*)$" "http://product.example.com/widget/$1" [P]
ProxyPassReverse "/products/widget/" "http://product.example.com/widget/"
</highlight>
@@ -78,9 +78,9 @@ ProxyPassReverse "/products/widget/" "http://product.example.com/widget/"
has been migrated yet.</p>
<highlight language="config">
-RewriteCond %{REQUEST_FILENAME} !-f
-RewriteCond %{REQUEST_FILENAME} !-d
-RewriteRule ^/(.*) http://old.example.com/$1 [P]
+RewriteCond "%{REQUEST_FILENAME}" !-f
+RewriteCond "%{REQUEST_FILENAME}" !-d
+RewriteRule "^/(.*)" "http://old.example.com/$1" [P]
ProxyPassReverse "/" "http://old.example.com/"
</highlight>
</dd>
diff --git a/docs/manual/rewrite/remapping.html.en b/docs/manual/rewrite/remapping.html.en
index debd3cdadb..db22af1778 100644
--- a/docs/manual/rewrite/remapping.html.en
+++ b/docs/manual/rewrite/remapping.html.en
@@ -75,7 +75,7 @@ configuration.</div>
following rule:</p>
<pre class="prettyprint lang-config">RewriteEngine on
-RewriteRule ^<strong>/foo</strong>\.html$ <strong>/bar</strong>.html [PT]</pre>
+RewriteRule "^<strong>/foo</strong>\.html$" "<strong>/bar</strong>.html" [PT]</pre>
</dd>
</dl>
@@ -105,7 +105,7 @@ RewriteRule ^<strong>/foo</strong>\.html$ <strong>/bar</strong>.html [PT]</p
change of the browsers and thus the users view:</p>
<pre class="prettyprint lang-config">RewriteEngine on
-RewriteRule ^<strong>/foo</strong>\.html$ <strong>bar</strong>.html [<strong>R</strong>]</pre>
+RewriteRule "^<strong>/foo</strong>\.html$" "<strong>bar</strong>.html" [<strong>R</strong>]</pre>
</dd>
@@ -146,7 +146,7 @@ RewriteRule ^<strong>/foo</strong>\.html$ <strong>bar</strong>.html [<stron
<pre class="prettyprint lang-config">#With mod_rewrite
RewriteEngine on
-RewriteRule ^/docs/(.+) http://new.example.com/docs/$1 [R,L]</pre>
+RewriteRule "^/docs/(.+)" "http://new.example.com/docs/$1" [R,L]</pre>
<pre class="prettyprint lang-config">#With RedirectMatch
@@ -186,8 +186,8 @@ Redirect "/docs/" "http://new.example.com/docs/"</pre>
<code>/~quux/foo.cgi</code>.</p>
<pre class="prettyprint lang-config">RewriteEngine on
-RewriteBase /~quux/
-RewriteRule ^foo\.html$ foo.cgi   [H=<strong>cgi-script</strong>]</pre>
+RewriteBase "/~quux/"
+RewriteRule "^foo\.html$" "foo.cgi" [H=<strong>cgi-script</strong>]</pre>
</dd>
</dl>
@@ -220,11 +220,11 @@ RewriteRule ^foo\.html$ foo.cgi   [H=<strong>cgi-script</strong>]</pre>
# when and only when document.php exists
&lt;Directory "/var/www/htdocs"&gt;
RewriteEngine on
- RewriteBase /var/www/htdocs
+ RewriteBase "/var/www/htdocs"
- RewriteCond $1.php -f
- RewriteCond $1.html !-f
- RewriteRule ^(.*).html$ $1.php
+ RewriteCond "$1.php" -f
+ RewriteCond "$1.html" !-f
+ RewriteRule "^(.*).html$" "$1.php"
&lt;/Directory&gt;</pre>
</dd>
@@ -307,16 +307,16 @@ might do the following:</p>
you might use one of the recipes below.</p>
<p>For sites running on a port other than 80:</p>
-<pre class="prettyprint lang-config">RewriteCond %{HTTP_HOST} !^www\.example\.com [NC]
-RewriteCond %{HTTP_HOST} !^$
-RewriteCond %{SERVER_PORT} !^80$
-RewriteRule ^/?(.*) http://www.example.com:%{SERVER_PORT}/$1 [L,R,NE]</pre>
+<pre class="prettyprint lang-config">RewriteCond "%{HTTP_HOST}" "!^www\.example\.com" [NC]
+RewriteCond "%{HTTP_HOST}" "!^$"
+RewriteCond "%{SERVER_PORT}" "!^80$"
+RewriteRule "^/?(.*)" "http://www.example.com:%{SERVER_PORT}/$1" [L,R,NE]</pre>
<p>And for a site running on port 80</p>
-<pre class="prettyprint lang-config">RewriteCond %{HTTP_HOST} !^www\.example\.com [NC]
-RewriteCond %{HTTP_HOST} !^$
-RewriteRule ^/?(.*) http://www.example.com/$1 [L,R,NE]</pre>
+<pre class="prettyprint lang-config">RewriteCond "%{HTTP_HOST}" "!^www\.example\.com" [NC]
+RewriteCond "%{HTTP_HOST}" "!^$"
+RewriteRule "^/?(.*)" "http://www.example.com/$1" [L,R,NE]</pre>
<p>
@@ -326,9 +326,9 @@ RewriteRule ^/?(.*) http://www.example.com/$1 [L,R,NE]</pre>
<strong>example.com</strong>, you could use the following
recipe:</p>
-<pre class="prettyprint lang-config">RewriteCond %{HTTP_HOST} !^www\. [NC]
-RewriteCond %{HTTP_HOST} !^$
-RewriteRule ^/?(.*) http://www.%{HTTP_HOST}/$1 [L,R,NE]</pre>
+<pre class="prettyprint lang-config">RewriteCond "%{HTTP_HOST}" "!^www\." [NC]
+RewriteCond "%{HTTP_HOST}" "!^$"
+RewriteRule "^/?(.*)" "http://www.%{HTTP_HOST}/$1" [L,R,NE]</pre>
<p>These rulesets will work either in your main server configuration
@@ -363,17 +363,17 @@ RewriteRule ^/?(.*) http://www.%{HTTP_HOST}/$1 [L,R,NE]</pre>
# first try to find it in dir1/...
# ...and if found stop and be happy:
-RewriteCond %{DOCUMENT_ROOT}/<strong>dir1</strong>/%{REQUEST_URI} -f
-RewriteRule ^(.+) %{DOCUMENT_ROOT}/<strong>dir1</strong>/$1 [L]
+RewriteCond "%{DOCUMENT_ROOT}/<strong>dir1</strong>/%{REQUEST_URI}" -f
+RewriteRule "^(.+)" "%{DOCUMENT_ROOT}/<strong>dir1</strong>/$1" [L]
# second try to find it in dir2/...
# ...and if found stop and be happy:
-RewriteCond %{DOCUMENT_ROOT}/<strong>dir2</strong>/%{REQUEST_URI} -f
-RewriteRule ^(.+) %{DOCUMENT_ROOT}/<strong>dir2</strong>/$1 [L]
+RewriteCond "%{DOCUMENT_ROOT}/<strong>dir2</strong>/%{REQUEST_URI}" -f
+RewriteRule "^(.+)" "%{DOCUMENT_ROOT}/<strong>dir2</strong>/$1" [L]
# else go on for other Alias or ScriptAlias directives,
# etc.
-RewriteRule ^ - [PT]</pre>
+RewriteRule "^" "-" [PT]</pre>
</dd>
</dl>
@@ -404,9 +404,9 @@ RewriteRule ^ - [PT]</pre>
<pre class="prettyprint lang-config">HostnameLookups on
RewriteEngine on
-RewriteMap multiplex txt:/path/to/map.mirrors
-RewriteCond %{REMOTE_HOST} ([a-z]+)$ [NC]
-RewriteRule ^/(.*)$ ${multiplex:<strong>%1</strong>|http://www.example.com/}$1 [R,L]</pre>
+RewriteMap multiplex "txt:/path/to/map.mirrors"
+RewriteCond "%{REMOTE_HOST}" "([a-z]+)$" [NC]
+RewriteRule "^/(.*)$" "${multiplex:<strong>%1</strong>|http://www.example.com/}$1" [R,L]</pre>
<div class="example"><p><code>
@@ -461,7 +461,7 @@ com http://www.example.com/<br />
we replace <code>/puppies</code> and <code>/canines</code>
by the canonical <code>/dogs</code>.</p>
-<pre class="prettyprint lang-config">RewriteRule ^/(puppies|canines)/(.*) /dogs/$2 [R]</pre>
+<pre class="prettyprint lang-config">RewriteRule "^/(puppies|canines)/(.*)" "/dogs/$2" [R]</pre>
</dd>
@@ -501,7 +501,7 @@ using the following ruleset:</p>
</p>
<pre class="prettyprint lang-config">RewriteEngine on
-RewriteRule ^/$ /about/ [<strong>R</strong>]</pre>
+RewriteRule "^/$" "/about/" [<strong>R</strong>]</pre>
<p>Note that this can also be handled using the <code class="directive"><a href="../mod/mod_alias.html#redirectmatch">RedirectMatch</a></code> directive:</p>
@@ -545,18 +545,18 @@ complicated than this, you can use a variation of the following rewrite
set to accomplish the same thing:</p>
<pre class="prettyprint lang-config">&lt;Directory "/var/www/my_blog"&gt;
- RewriteBase /my_blog
+ RewriteBase "/my_blog"
- RewriteCond /var/www/my_blog/%{REQUEST_FILENAME} !-f
- RewriteCond /var/www/my_blog/%{REQUEST_FILENAME} !-d
- RewriteRule ^ index.php [PT]
+ RewriteCond "/var/www/my_blog/%{REQUEST_FILENAME}" !-f
+ RewriteCond "/var/www/my_blog/%{REQUEST_FILENAME}" !-d
+ RewriteRule "^" "index.php" [PT]
&lt;/Directory&gt;</pre>
<p>If, on the other hand, you wish to pass the requested URI as a query
string argument to index.php, you can replace that RewriteRule with:</p>
-<pre class="prettyprint lang-config">RewriteRule (.*) index.php?$1 [PT,QSA]</pre>
+<pre class="prettyprint lang-config">RewriteRule "(.*)" "index.php?$1" [PT,QSA]</pre>
<p>Note that these rulesets can be used in a <code>.htaccess</code>
@@ -582,14 +582,14 @@ of the URL.</dd>
<p> Many of the solutions in this section will all use the same condition,
which leaves the matched value in the %2 backreference. %1 is the beginining
of the query string (up to the key of intererest), and %3 is the remainder. This
-condition is a bit complex for flexibility and to avoid double '&amp;&amp;' in the
+condition is a bit complex for flexibility and to avoid double '&amp;&amp;' in the
substitutions.</p>
<ul>
<li>This solution removes the matching key and value:
<pre class="prettyprint lang-config"># Remove mykey=???
-RewriteCond %{QUERY_STRING} (.*(?:^|&amp;))mykey=([^&amp;]*)&amp;?(.*)&amp;?$
-RewriteRule (.*) $1?%1%3</pre>
+RewriteCond "%{QUERY_STRING}" "(.*(?:^|&amp;))mykey=([^&amp;]*)&amp;?(.*)&amp;?$"
+RewriteRule "(.*)" "$1?%1%3"</pre>
</li>
@@ -597,25 +597,25 @@ RewriteRule (.*) $1?%1%3</pre>
discarding the rest of the original query by appending a '?':
<pre class="prettyprint lang-config"># Copy from query string to PATH_INFO
-RewriteCond %{QUERY_STRING} (.*(?:^|&amp;))mykey=([^&amp;]*)&amp;?(.*)&amp;?$
-RewriteRule (.*) $1/products/%2/? [PT]</pre>
+RewriteCond "%{QUERY_STRING}" "(.*(?:^|&amp;))mykey=([^&amp;]*)&amp;?(.*)&amp;?$"
+RewriteRule "(.*)" "$1/products/%2/?" [PT]</pre>
</li>
<li>This solution checks the captured value in a subsequent condition:
<pre class="prettyprint lang-config"># Capture the value of mykey in the query string
-RewriteCond %{QUERY_STRING} (.*(?:^|&amp;))mykey=([^&amp;]*)&amp;?(.*)&amp;?$
-RewriteCond %2 !=not-so-secret-value
-RewriteRule (.*) - [F]</pre>
+RewriteCond "%{QUERY_STRING}" "(.*(?:^|&amp;))mykey=([^&amp;]*)&amp;?(.*)&amp;?$"
+RewriteCond "%2" !=not-so-secret-value
+RewriteRule "(.*)" "-" [F]</pre>
</li>
<li>This solution shows the reverse of the previous ones, copying
path components (perhaps PATH_INFO) from the URL into the query string.
-<pre class="prettyprint lang-config"># The desired URL might be /products/kitchen-sink, and the script expects
+<pre class="prettyprint lang-config"># The desired URL might be /products/kitchen-sink, and the script expects
# /path?products=kitchen-sink.
-RewriteRule ^/?path/([^/]+)/([^/]+) /path?$1=$2 [PT]</pre>
+RewriteRule "^/?path/([^/]+)/([^/]+)" "/path?$1=$2" [PT]</pre>
</li>
</ul>
diff --git a/docs/manual/rewrite/remapping.xml b/docs/manual/rewrite/remapping.xml
index d392472a1b..9a9866c770 100644
--- a/docs/manual/rewrite/remapping.xml
+++ b/docs/manual/rewrite/remapping.xml
@@ -73,7 +73,7 @@ configuration.</note>
<highlight language="config">
RewriteEngine on
-RewriteRule ^<strong>/foo</strong>\.html$ <strong>/bar</strong>.html [PT]
+RewriteRule "^<strong>/foo</strong>\.html$" "<strong>/bar</strong>.html" [PT]
</highlight>
</dd>
</dl>
@@ -104,7 +104,7 @@ RewriteRule ^<strong>/foo</strong>\.html$ <strong>/bar</strong>.html [PT]
<highlight language="config">
RewriteEngine on
-RewriteRule ^<strong>/foo</strong>\.html$ <strong>bar</strong>.html [<strong>R</strong>]
+RewriteRule "^<strong>/foo</strong>\.html$" "<strong>bar</strong>.html" [<strong>R</strong>]
</highlight>
</dd>
@@ -148,7 +148,7 @@ Redirect "/foo.html" "/bar.html"
<highlight language="config">
#With mod_rewrite
RewriteEngine on
-RewriteRule ^/docs/(.+) http://new.example.com/docs/$1 [R,L]
+RewriteRule "^/docs/(.+)" "http://new.example.com/docs/$1" [R,L]
</highlight>
<highlight language="config">
@@ -191,8 +191,8 @@ Redirect "/docs/" "http://new.example.com/docs/"
<highlight language="config">
RewriteEngine on
-RewriteBase /~quux/
-RewriteRule ^foo\.html$ foo.cgi &nbsp; [H=<strong>cgi-script</strong>]
+RewriteBase "/~quux/"
+RewriteRule "^foo\.html$" "foo.cgi" [H=<strong>cgi-script</strong>]
</highlight>
</dd>
</dl>
@@ -226,11 +226,11 @@ RewriteRule ^foo\.html$ foo.cgi &nbsp; [H=<strong>cgi-script</strong>]
# when and only when document.php exists
&lt;Directory "/var/www/htdocs"&gt;
RewriteEngine on
- RewriteBase /var/www/htdocs
+ RewriteBase "/var/www/htdocs"
- RewriteCond $1.php -f
- RewriteCond $1.html !-f
- RewriteRule ^(.*).html$ $1.php
+ RewriteCond "$1.php" -f
+ RewriteCond "$1.html" !-f
+ RewriteRule "^(.*).html$" "$1.php"
&lt;/Directory&gt;
</highlight>
</dd>
@@ -318,17 +318,17 @@ you might use one of the recipes below.</p>
<p>For sites running on a port other than 80:</p>
<highlight language="config">
-RewriteCond %{HTTP_HOST} !^www\.example\.com [NC]
-RewriteCond %{HTTP_HOST} !^$
-RewriteCond %{SERVER_PORT} !^80$
-RewriteRule ^/?(.*) http://www.example.com:%{SERVER_PORT}/$1 [L,R,NE]
+RewriteCond "%{HTTP_HOST}" "!^www\.example\.com" [NC]
+RewriteCond "%{HTTP_HOST}" "!^$"
+RewriteCond "%{SERVER_PORT}" "!^80$"
+RewriteRule "^/?(.*)" "http://www.example.com:%{SERVER_PORT}/$1" [L,R,NE]
</highlight>
<p>And for a site running on port 80</p>
<highlight language="config">
-RewriteCond %{HTTP_HOST} !^www\.example\.com [NC]
-RewriteCond %{HTTP_HOST} !^$
-RewriteRule ^/?(.*) http://www.example.com/$1 [L,R,NE]
+RewriteCond "%{HTTP_HOST}" "!^www\.example\.com" [NC]
+RewriteCond "%{HTTP_HOST}" "!^$"
+RewriteRule "^/?(.*)" "http://www.example.com/$1" [L,R,NE]
</highlight>
<p>
@@ -339,9 +339,9 @@ RewriteRule ^/?(.*) http://www.example.com/$1 [L,R,NE]
recipe:</p>
<highlight language="config">
-RewriteCond %{HTTP_HOST} !^www\. [NC]
-RewriteCond %{HTTP_HOST} !^$
-RewriteRule ^/?(.*) http://www.%{HTTP_HOST}/$1 [L,R,NE]
+RewriteCond "%{HTTP_HOST}" "!^www\." [NC]
+RewriteCond "%{HTTP_HOST}" "!^$"
+RewriteRule "^/?(.*)" "http://www.%{HTTP_HOST}/$1" [L,R,NE]
</highlight>
<p>These rulesets will work either in your main server configuration
@@ -378,17 +378,17 @@ RewriteEngine on
# first try to find it in dir1/...
# ...and if found stop and be happy:
-RewriteCond %{DOCUMENT_ROOT}/<strong>dir1</strong>/%{REQUEST_URI} -f
-RewriteRule ^(.+) %{DOCUMENT_ROOT}/<strong>dir1</strong>/$1 [L]
+RewriteCond "%{DOCUMENT_ROOT}/<strong>dir1</strong>/%{REQUEST_URI}" -f
+RewriteRule "^(.+)" "%{DOCUMENT_ROOT}/<strong>dir1</strong>/$1" [L]
# second try to find it in dir2/...
# ...and if found stop and be happy:
-RewriteCond %{DOCUMENT_ROOT}/<strong>dir2</strong>/%{REQUEST_URI} -f
-RewriteRule ^(.+) %{DOCUMENT_ROOT}/<strong>dir2</strong>/$1 [L]
+RewriteCond "%{DOCUMENT_ROOT}/<strong>dir2</strong>/%{REQUEST_URI}" -f
+RewriteRule "^(.+)" "%{DOCUMENT_ROOT}/<strong>dir2</strong>/$1" [L]
# else go on for other Alias or ScriptAlias directives,
# etc.
-RewriteRule ^ - [PT]
+RewriteRule "^" "-" [PT]
</highlight>
</dd>
</dl>
@@ -420,9 +420,9 @@ RewriteRule ^ - [PT]
<highlight language="config">
HostnameLookups on
RewriteEngine on
-RewriteMap multiplex txt:/path/to/map.mirrors
-RewriteCond %{REMOTE_HOST} ([a-z]+)$ [NC]
-RewriteRule ^/(.*)$ ${multiplex:<strong>%1</strong>|http://www.example.com/}$1 [R,L]
+RewriteMap multiplex "txt:/path/to/map.mirrors"
+RewriteCond "%{REMOTE_HOST}" "([a-z]+)$" [NC]
+RewriteRule "^/(.*)$" "${multiplex:<strong>%1</strong>|http://www.example.com/}$1" [R,L]
</highlight>
<example>
@@ -478,7 +478,7 @@ com http://www.example.com/<br />
by the canonical <code>/dogs</code>.</p>
<highlight language="config">
-RewriteRule ^/(puppies|canines)/(.*) /dogs/$2 [R]
+RewriteRule "^/(puppies|canines)/(.*)" "/dogs/$2" [R]
</highlight>
</dd>
@@ -520,7 +520,7 @@ using the following ruleset:</p>
<highlight language="config">
RewriteEngine on
-RewriteRule ^/$ /about/ [<strong>R</strong>]
+RewriteRule "^/$" "/about/" [<strong>R</strong>]
</highlight>
<p>Note that this can also be handled using the <directive
@@ -569,11 +569,11 @@ set to accomplish the same thing:</p>
<highlight language="config">
&lt;Directory "/var/www/my_blog"&gt;
- RewriteBase /my_blog
+ RewriteBase "/my_blog"
- RewriteCond /var/www/my_blog/%{REQUEST_FILENAME} !-f
- RewriteCond /var/www/my_blog/%{REQUEST_FILENAME} !-d
- RewriteRule ^ index.php [PT]
+ RewriteCond "/var/www/my_blog/%{REQUEST_FILENAME}" !-f
+ RewriteCond "/var/www/my_blog/%{REQUEST_FILENAME}" !-d
+ RewriteRule "^" "index.php" [PT]
&lt;/Directory&gt;
</highlight>
@@ -581,7 +581,7 @@ set to accomplish the same thing:</p>
string argument to index.php, you can replace that RewriteRule with:</p>
<highlight language="config">
-RewriteRule (.*) index.php?$1 [PT,QSA]
+RewriteRule "(.*)" "index.php?$1" [PT,QSA]
</highlight>
<p>Note that these rulesets can be used in a <code>.htaccess</code>
@@ -614,8 +614,8 @@ substitutions.</p>
<highlight language="config">
# Remove mykey=???
-RewriteCond %{QUERY_STRING} (.*(?:^|&amp;))mykey=([^&amp;]*)&amp;?(.*)&amp;?$
-RewriteRule (.*) $1?%1%3
+RewriteCond "%{QUERY_STRING}" "(.*(?:^|&amp;))mykey=([^&amp;]*)&amp;?(.*)&amp;?$"
+RewriteRule "(.*)" "$1?%1%3"
</highlight>
</li>
@@ -624,8 +624,8 @@ RewriteRule (.*) $1?%1%3
<highlight language="config">
# Copy from query string to PATH_INFO
-RewriteCond %{QUERY_STRING} (.*(?:^|&amp;))mykey=([^&amp;]*)&amp;?(.*)&amp;?$
-RewriteRule (.*) $1/products/%2/? [PT]
+RewriteCond "%{QUERY_STRING}" "(.*(?:^|&amp;))mykey=([^&amp;]*)&amp;?(.*)&amp;?$"
+RewriteRule "(.*)" "$1/products/%2/?" [PT]
</highlight>
</li>
@@ -633,9 +633,9 @@ RewriteRule (.*) $1/products/%2/? [PT]
<highlight language="config">
# Capture the value of mykey in the query string
-RewriteCond %{QUERY_STRING} (.*(?:^|&amp;))mykey=([^&amp;]*)&amp;?(.*)&amp;?$
-RewriteCond %2 !=not-so-secret-value
-RewriteRule (.*) - [F]
+RewriteCond "%{QUERY_STRING}" "(.*(?:^|&amp;))mykey=([^&amp;]*)&amp;?(.*)&amp;?$"
+RewriteCond "%2" !=not-so-secret-value
+RewriteRule "(.*)" "-" [F]
</highlight>
</li>
@@ -644,7 +644,7 @@ RewriteRule (.*) - [F]
<highlight language="config">
# The desired URL might be /products/kitchen-sink, and the script expects
# /path?products=kitchen-sink.
-RewriteRule ^/?path/([^/]+)/([^/]+) /path?$1=$2 [PT]
+RewriteRule "^/?path/([^/]+)/([^/]+)" "/path?$1=$2" [PT]
</highlight>
</li>
</ul>
diff --git a/docs/manual/rewrite/rewritemap.html.en b/docs/manual/rewrite/rewritemap.html.en
index ff5fee698c..c1be7ddc2b 100644
--- a/docs/manual/rewrite/rewritemap.html.en
+++ b/docs/manual/rewrite/rewritemap.html.en
@@ -64,7 +64,8 @@ configuration.</div>
<p>The syntax of the <code>RewriteMap</code> directive is as
follows:</p>
-<pre class="prettyprint lang-config">RewriteMap <em>MapName</em> <em>MapType</em>:<em>MapSource</em></pre>
+<pre class="prettyprint lang-config">RewriteMap <em>MapName</em> <em>MapType</em>:<em>MapSource</em>
+</pre>
<p>The <a id="mapfunc" name="mapfunc"><em>MapName</em></a> is an
@@ -89,17 +90,17 @@ configuration.</div>
<p>For example, you can define a
<code class="directive">RewriteMap</code> as:</p>
- <pre class="prettyprint lang-config">RewriteMap examplemap txt:/path/to/file/map.txt</pre>
+ <pre class="prettyprint lang-config">RewriteMap examplemap "txt:/path/to/file/map.txt"</pre>
<p>You would then be able to use this map in a
<code class="directive">RewriteRule</code> as follows:</p>
-<pre class="prettyprint lang-config">RewriteRule ^/ex/(.*) ${examplemap:$1}</pre>
+ <pre class="prettyprint lang-config">RewriteRule "^/ex/(.*)" "${examplemap:$1}"</pre>
<p>A default value can be specified in the event that nothing is found
in the map:</p>
-<pre class="prettyprint lang-config">RewriteRule ^/ex/(.*) ${examplemap:$1|/not_found.html}</pre>
+<pre class="prettyprint lang-config">RewriteRule "^/ex/(.*)" "${examplemap:$1|/not_found.html}"</pre>
<div class="note"><h3>Per-directory and .htaccess context</h3>
@@ -146,8 +147,8 @@ may be used, and give examples of each.</p>
</p>
<p> <strong>Redirect a URI to an all-lowercase version of itself</strong></p>
- <pre class="prettyprint lang-config">RewriteMap lc int:tolower
-RewriteRule (.*?[A-Z]+.*) ${lc:$1} [R]</pre>
+ <pre class="prettyprint lang-config">RewriteMap lc "int:tolower"
+RewriteRule "(.*?[A-Z]+.*)" "${lc:$1}" [R]</pre>
<div class="note">
@@ -184,8 +185,8 @@ RewriteRule (.*?[A-Z]+.*) ${lc:$1} [R]</pre>
product IDs for easier-to-remember URLs, using the following
recipe:</p>
<p><strong>Product to ID configuration</strong></p>
- <pre class="prettyprint lang-config">RewriteMap product2id txt:/etc/apache2/productmap.txt
-RewriteRule ^/product/(.*) /prods.php?id=${product2id:$1|NOTFOUND} [PT]</pre>
+ <pre class="prettyprint lang-config">RewriteMap product2id "txt:/etc/apache2/productmap.txt"
+RewriteRule "^/product/(.*)" "/prods.php?id=${product2id:$1|NOTFOUND}" [PT]</pre>
<p>We assume here that the <code>prods.php</code> script knows what
@@ -216,7 +217,7 @@ telephone 328
scope. If you're planning to use this in a <code>.htaccess</code>
file, you'll need to remove the leading slash from the rewrite
pattern in order for it to match anything:
- <pre class="prettyprint lang-config">RewriteRule ^product/(.*) /prods.php?id=${product2id:$1|NOTFOUND} [PT]</pre>
+ <pre class="prettyprint lang-config">RewriteRule "^product/(.*)" "/prods.php?id=${product2id:$1|NOTFOUND}" [PT]</pre>
</div>
@@ -255,10 +256,10 @@ static www1|www2|www3|www4<br />
dynamic www5|www6
</code></p></div>
<p><strong>Configuration directives</strong></p>
- <pre class="prettyprint lang-config">RewriteMap servers rnd:/path/to/file/map.txt
+ <pre class="prettyprint lang-config">RewriteMap servers "rnd:/path/to/file/map.txt"
-RewriteRule ^/(.*\.(png|gif|jpg)) http://${servers:static}/$1 [NC,P,L]
-RewriteRule ^/(.*) http://${servers:dynamic}/$1 [P,L]</pre>
+RewriteRule "^/(.*\.(png|gif|jpg))" "http://${servers:static}/$1" [NC,P,L]
+RewriteRule "^/(.*)" "http://${servers:dynamic}/$1" [P,L]</pre>
<p>So, when an image is requested and the first of these rules is
@@ -290,7 +291,7 @@ static www1|www1|www2|www3|www4
<p>You may optionally specify a particular dbm type:</p>
- <pre class="prettyprint lang-config">RewriteMap examplemap dbm=sdbm:/etc/apache/mapfile.dbm</pre>
+ <pre class="prettyprint lang-config">RewriteMap examplemap "dbm=sdbm:/etc/apache/mapfile.dbm"</pre>
<p>The type can be sdbm, gdbm, ndbm or db.
@@ -309,7 +310,7 @@ $ httxt2dbm -i mapfile.txt -o mapfile.map
<p>You can then reference the resulting file in your
<code>RewriteMap</code> directive:</p>
-<pre class="prettyprint lang-config">RewriteMap mapname dbm:/etc/apache/mapfile.map</pre>
+<pre class="prettyprint lang-config">RewriteMap mapname "dbm:/etc/apache/mapfile.map"</pre>
<div class="note">
@@ -364,10 +365,10 @@ by many requests.
<p>A simple example is shown here which will replace all dashes with
underscores in a request URI.</p>
-
+
<p><strong>Rewrite configuration</strong></p>
- <pre class="prettyprint lang-config">RewriteMap d2u prg:/www/bin/dash2under.pl apache:apache<br />
-RewriteRule - ${d2u:%{REQUEST_URI}}</pre>
+ <pre class="prettyprint lang-config">RewriteMap d2u "prg:/www/bin/dash2under.programlisting" apache:apache<br />
+RewriteRule "-" "${d2u:%{REQUEST_URI}}"</pre>
<p><strong>dash2under.pl</strong></p>
diff --git a/docs/manual/rewrite/rewritemap.xml b/docs/manual/rewrite/rewritemap.xml
index 0b33e52690..c4e7df590b 100644
--- a/docs/manual/rewrite/rewritemap.xml
+++ b/docs/manual/rewrite/rewritemap.xml
@@ -87,19 +87,19 @@ RewriteMap <em>MapName</em> <em>MapType</em>:<em>MapSource</em>
<p>For example, you can define a
<directive>RewriteMap</directive> as:</p>
<highlight language="config">
-RewriteMap examplemap txt:/path/to/file/map.txt
+RewriteMap examplemap "txt:/path/to/file/map.txt"
</highlight>
<p>You would then be able to use this map in a
<directive>RewriteRule</directive> as follows:</p>
<highlight language="config">
-RewriteRule ^/ex/(.*) ${examplemap:$1}
+RewriteRule "^/ex/(.*)" "${examplemap:$1}"
</highlight>
<p>A default value can be specified in the event that nothing is found
in the map:</p>
<highlight language="config">
-RewriteRule ^/ex/(.*) ${examplemap:$1|/not_found.html}
+RewriteRule "^/ex/(.*)" "${examplemap:$1|/not_found.html}"
</highlight>
<note><title>Per-directory and .htaccess context</title>
@@ -147,8 +147,8 @@ may be used, and give examples of each.</p>
<p> <strong>Redirect a URI to an all-lowercase version of itself</strong></p>
<highlight language="config">
-RewriteMap lc int:tolower
-RewriteRule (.*?[A-Z]+.*) ${lc:$1} [R]
+RewriteMap lc "int:tolower"
+RewriteRule "(.*?[A-Z]+.*)" "${lc:$1}" [R]
</highlight>
<note>
@@ -186,8 +186,8 @@ RewriteRule (.*?[A-Z]+.*) ${lc:$1} [R]
recipe:</p>
<p><strong>Product to ID configuration</strong></p>
<highlight language="config">
-RewriteMap product2id txt:/etc/apache2/productmap.txt
-RewriteRule ^/product/(.*) /prods.php?id=${product2id:$1|NOTFOUND} [PT]
+RewriteMap product2id "txt:/etc/apache2/productmap.txt"
+RewriteRule "^/product/(.*)" "/prods.php?id=${product2id:$1|NOTFOUND}" [PT]
</highlight>
<p>We assume here that the <code>prods.php</code> script knows what
@@ -219,7 +219,7 @@ telephone 328
file, you'll need to remove the leading slash from the rewrite
pattern in order for it to match anything:
<highlight language="config">
-RewriteRule ^product/(.*) /prods.php?id=${product2id:$1|NOTFOUND} [PT]
+RewriteRule "^product/(.*)" "/prods.php?id=${product2id:$1|NOTFOUND}" [PT]
</highlight>
</note>
@@ -258,10 +258,10 @@ dynamic www5|www6
</example>
<p><strong>Configuration directives</strong></p>
<highlight language="config">
-RewriteMap servers rnd:/path/to/file/map.txt
+RewriteMap servers "rnd:/path/to/file/map.txt"
-RewriteRule ^/(.*\.(png|gif|jpg)) http://${servers:static}/$1 [NC,P,L]
-RewriteRule ^/(.*) http://${servers:dynamic}/$1 [P,L]
+RewriteRule "^/(.*\.(png|gif|jpg))" "http://${servers:static}/$1" [NC,P,L]
+RewriteRule "^/(.*)" "http://${servers:dynamic}/$1" [P,L]
</highlight>
<p>So, when an image is requested and the first of these rules is
@@ -294,7 +294,7 @@ static www1|www1|www2|www3|www4
<p>You may optionally specify a particular dbm type:</p>
<highlight language="config">
-RewriteMap examplemap dbm=sdbm:/etc/apache/mapfile.dbm
+RewriteMap examplemap "dbm=sdbm:/etc/apache/mapfile.dbm"
</highlight>
<p>The type can be sdbm, gdbm, ndbm or db.
@@ -315,7 +315,7 @@ $ httxt2dbm -i mapfile.txt -o mapfile.map
<code>RewriteMap</code> directive:</p>
<highlight language="config">
-RewriteMap mapname dbm:/etc/apache/mapfile.map
+RewriteMap mapname "dbm:/etc/apache/mapfile.map"
</highlight>
<note>
@@ -374,8 +374,8 @@ by many requests.
<p><strong>Rewrite configuration</strong></p>
<highlight language="config">
-RewriteMap d2u prg:/www/bin/dash2under.pl apache:apache<br />
-RewriteRule - ${d2u:%{REQUEST_URI}}
+RewriteMap d2u "prg:/www/bin/dash2under.programlisting" apache:apache<br />
+RewriteRule "-" "${d2u:%{REQUEST_URI}}"
</highlight>
<p><strong>dash2under.pl</strong></p>
diff --git a/docs/manual/rewrite/tech.html.en b/docs/manual/rewrite/tech.html.en
index b743efb377..e8a90490a6 100644
--- a/docs/manual/rewrite/tech.html.en
+++ b/docs/manual/rewrite/tech.html.en
@@ -77,11 +77,11 @@ and URL matching.</p>
for /foo/bar/baz is being processed, an expression like ^bar/baz$ would
match.</p>
- <p> If a substitution is made in per-directory context, a new internal
- subrequest is issued with the new URL, which restarts processing of the
- request phases. If the substitution is a relative path, the <code class="directive"><a href="../mod/mod_rewrite.html#rewritebase">RewriteBase</a></code> directive
+ <p> If a substitution is made in per-directory context, a new internal
+ subrequest is issued with the new URL, which restarts processing of the
+ request phases. If the substitution is a relative path, the <code class="directive"><a href="../mod/mod_rewrite.html#rewritebase">RewriteBase</a></code> directive
determines the URL-path prefix prepended to the substitution.
- In per-directory context, care must be taken to
+ In per-directory context, care must be taken to
create rules which will eventually (in some future "round" of per-directory
rewrite processing) not perform a substitution to avoid looping.
(See <a href="http://wiki.apache.org/httpd/RewriteLooping">RewriteLooping</a>
@@ -103,23 +103,23 @@ and URL matching.</p>
<tr>
<td>VirtualHost section</td>
- <td>RewriteRule ^/images/(.+)\.jpg /images/$1.gif</td>
+ <td>RewriteRule "^/images/(.+)\.jpg" "/images/$1.gif"</td>
</tr>
<tr>
<td>.htaccess file in document root</td>
- <td>RewriteRule ^images/(.+)\.jpg images/$1.gif</td>
+ <td>RewriteRule "^images/(.+)\.jpg" "images/$1.gif"</td>
</tr>
<tr>
<td>.htaccess file in images directory</td>
- <td>RewriteRule ^(.+)\.jpg $1.gif</td>
+ <td>RewriteRule "^(.+)\.jpg" "$1.gif"</td>
</tr>
</table>
<p>For even more insight into how mod_rewrite manipulates URLs in
- different contexts, you should consult the <a href="../mod/mod_rewrite.html#logging">log entries</a> made during
+ different contexts, you should consult the <a href="../mod/mod_rewrite.html#logging">log entries</a> made during
rewriting.</p>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
diff --git a/docs/manual/rewrite/tech.xml b/docs/manual/rewrite/tech.xml
index 83a69f3fc4..e22c7cf8e1 100644
--- a/docs/manual/rewrite/tech.xml
+++ b/docs/manual/rewrite/tech.xml
@@ -76,7 +76,7 @@ and URL matching.</p>
<p>In per-directory context (i.e., within <code>.htaccess</code> files
and <code>Directory</code> blocks), these rules are being applied
after a URL has already been translated to a filename. Because of
- this, the URL-path that mod_rewrite initially compares <directive
+ this, the URL-path that mod_rewrite initially compares <directive
module="mod_rewrite">RewriteRule</directive> directives against
is the full filesystem path to the translated filename with the current
directories path (including a trailing slash) removed from the front.</p>
@@ -85,12 +85,12 @@ and URL matching.</p>
for /foo/bar/baz is being processed, an expression like ^bar/baz$ would
match.</p>
- <p> If a substitution is made in per-directory context, a new internal
- subrequest is issued with the new URL, which restarts processing of the
- request phases. If the substitution is a relative path, the <directive
- module="mod_rewrite">RewriteBase</directive> directive
+ <p> If a substitution is made in per-directory context, a new internal
+ subrequest is issued with the new URL, which restarts processing of the
+ request phases. If the substitution is a relative path, the <directive
+ module="mod_rewrite">RewriteBase</directive> directive
determines the URL-path prefix prepended to the substitution.
- In per-directory context, care must be taken to
+ In per-directory context, care must be taken to
create rules which will eventually (in some future "round" of per-directory
rewrite processing) not perform a substitution to avoid looping.
(See <a href="http://wiki.apache.org/httpd/RewriteLooping">RewriteLooping</a>
@@ -112,24 +112,24 @@ and URL matching.</p>
<tr>
<td>VirtualHost section</td>
- <td>RewriteRule ^/images/(.+)\.jpg /images/$1.gif</td>
+ <td>RewriteRule "^/images/(.+)\.jpg" "/images/$1.gif"</td>
</tr>
<tr>
<td>.htaccess file in document root</td>
- <td>RewriteRule ^images/(.+)\.jpg images/$1.gif</td>
+ <td>RewriteRule "^images/(.+)\.jpg" "images/$1.gif"</td>
</tr>
<tr>
<td>.htaccess file in images directory</td>
- <td>RewriteRule ^(.+)\.jpg $1.gif</td>
+ <td>RewriteRule "^(.+)\.jpg" "$1.gif"</td>
</tr>
</table>
<p>For even more insight into how mod_rewrite manipulates URLs in
different contexts, you should consult the <a
- href="../mod/mod_rewrite.html#logging">log entries</a> made during
+ href="../mod/mod_rewrite.html#logging">log entries</a> made during
rewriting.</p>
</section>
@@ -188,4 +188,3 @@ and URL matching.</p>
</manualpage>
-
diff --git a/docs/manual/rewrite/vhosts.html.en b/docs/manual/rewrite/vhosts.html.en
index 1946a98d21..8ad14c9eb0 100644
--- a/docs/manual/rewrite/vhosts.html.en
+++ b/docs/manual/rewrite/vhosts.html.en
@@ -67,10 +67,10 @@ mod_rewrite</a> document.</div>
<pre class="prettyprint lang-config">RewriteEngine on
-RewriteMap lowercase int:tolower
+RewriteMap lowercase "int:tolower"
-RewriteCond ${lowercase:%{<strong>HTTP_HOST</strong>}} ^www\.<strong>([^.]+)</strong>\.example\.com$
-RewriteRule ^(.*) /home/<strong>%1</strong>/www$1</pre>
+RewriteCond "${lowercase:%{<strong>HTTP_HOST</strong>}}" "^www\.<strong>([^.]+)</strong>\.example\.com$"
+RewriteRule "^(.*)" "/home/<strong>%1</strong>/www$1"</pre>
</dd>
<dt>Discussion</dt>
@@ -137,19 +137,19 @@ CustomLog logs/access_log vcommon
RewriteEngine On
# a ServerName derived from a Host: header may be any case at all
-RewriteMap lowercase int:tolower
+RewriteMap lowercase "int:tolower"
## deal with normal documents first:
# allow Alias /icons/ to work - repeat for other aliases
-RewriteCond %{REQUEST_URI} !^/icons/
+RewriteCond "%{REQUEST_URI}" "!^/icons/"
# allow CGIs to work
-RewriteCond %{REQUEST_URI} !^/cgi-bin/
+RewriteCond "%{REQUEST_URI}" "!^/cgi-bin/"
# do the magic
-RewriteRule ^/(.*)$ /www/hosts/${lowercase:%{SERVER_NAME}}/docs/$1
+RewriteRule "^/(.*)$" "/www/hosts/${lowercase:%{SERVER_NAME}}/docs/$1"
## and now deal with CGIs - we have to force a handler
-RewriteCond %{REQUEST_URI} ^/cgi-bin/
-RewriteRule ^/(.*)$ /www/hosts/${lowercase:%{SERVER_NAME}}/cgi-bin/$1 [H=cgi-script]</pre>
+RewriteCond "%{REQUEST_URI}" "^/cgi-bin/"
+RewriteRule "^/(.*)$" "/www/hosts/${lowercase:%{SERVER_NAME}}/cgi-bin/$1" [H=cgi-script]</pre>
</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
@@ -175,23 +175,23 @@ customer-N.example.com /www/customers/N<br />
<pre class="prettyprint lang-config">RewriteEngine on
-RewriteMap lowercase int:tolower
+RewriteMap lowercase "int:tolower"
# define the map file
-RewriteMap vhost txt:/www/conf/vhost.map
+RewriteMap vhost "txt:/www/conf/vhost.map"
# deal with aliases as above
-RewriteCond %{REQUEST_URI} !^/icons/
-RewriteCond %{REQUEST_URI} !^/cgi-bin/
-RewriteCond ${lowercase:%{SERVER_NAME}} ^(.+)$
+RewriteCond "%{REQUEST_URI}" "!^/icons/"
+RewriteCond "%{REQUEST_URI}" "!^/cgi-bin/"
+RewriteCond "${lowercase:%{SERVER_NAME}}" "^(.+)$"
# this does the file-based remap
-RewriteCond ${vhost:%1} ^(/.*)$
-RewriteRule ^/(.*)$ %1/docs/$1
+RewriteCond "${vhost:%1}" "^(/.*)$"
+RewriteRule "^/(.*)$" "%1/docs/$1"
-RewriteCond %{REQUEST_URI} ^/cgi-bin/
-RewriteCond ${lowercase:%{SERVER_NAME}} ^(.+)$
-RewriteCond ${vhost:%1} ^(/.*)$
-RewriteRule ^/(.*)$ %1/cgi-bin/$1 [H=cgi-script]</pre>
+RewriteCond "%{REQUEST_URI}" "^/cgi-bin/"
+RewriteCond "${lowercase:%{SERVER_NAME}}" "^(.+)$"
+RewriteCond "${vhost:%1}" "^(/.*)$"
+RewriteRule "^/(.*)$" "%1/cgi-bin/$1" [H=cgi-script]</pre>
</div></div>
diff --git a/docs/manual/rewrite/vhosts.xml b/docs/manual/rewrite/vhosts.xml
index 8a44a85016..1cea3de087 100644
--- a/docs/manual/rewrite/vhosts.xml
+++ b/docs/manual/rewrite/vhosts.xml
@@ -74,10 +74,10 @@ mod_rewrite</a> document.</note>
<highlight language="config">
RewriteEngine on
-RewriteMap lowercase int:tolower
+RewriteMap lowercase "int:tolower"
-RewriteCond ${lowercase:%{<strong>HTTP_HOST</strong>}} ^www\.<strong>([^.]+)</strong>\.example\.com$
-RewriteRule ^(.*) /home/<strong>%1</strong>/www$1
+RewriteCond "${lowercase:%{<strong>HTTP_HOST</strong>}}" "^www\.<strong>([^.]+)</strong>\.example\.com$"
+RewriteRule "^(.*)" "/home/<strong>%1</strong>/www$1"
</highlight></dd>
<dt>Discussion</dt>
@@ -146,19 +146,19 @@ CustomLog logs/access_log vcommon
RewriteEngine On
# a ServerName derived from a Host: header may be any case at all
-RewriteMap lowercase int:tolower
+RewriteMap lowercase "int:tolower"
## deal with normal documents first:
# allow Alias /icons/ to work - repeat for other aliases
-RewriteCond %{REQUEST_URI} !^/icons/
+RewriteCond "%{REQUEST_URI}" "!^/icons/"
# allow CGIs to work
-RewriteCond %{REQUEST_URI} !^/cgi-bin/
+RewriteCond "%{REQUEST_URI}" "!^/cgi-bin/"
# do the magic
-RewriteRule ^/(.*)$ /www/hosts/${lowercase:%{SERVER_NAME}}/docs/$1
+RewriteRule "^/(.*)$" "/www/hosts/${lowercase:%{SERVER_NAME}}/docs/$1"
## and now deal with CGIs - we have to force a handler
-RewriteCond %{REQUEST_URI} ^/cgi-bin/
-RewriteRule ^/(.*)$ /www/hosts/${lowercase:%{SERVER_NAME}}/cgi-bin/$1 [H=cgi-script]
+RewriteCond "%{REQUEST_URI}" "^/cgi-bin/"
+RewriteRule "^/(.*)$" "/www/hosts/${lowercase:%{SERVER_NAME}}/cgi-bin/$1" [H=cgi-script]
</highlight>
</section>
@@ -185,23 +185,23 @@ customer-N.example.com /www/customers/N<br />
<highlight language="config">
RewriteEngine on
-RewriteMap lowercase int:tolower
+RewriteMap lowercase "int:tolower"
# define the map file
-RewriteMap vhost txt:/www/conf/vhost.map
+RewriteMap vhost "txt:/www/conf/vhost.map"
# deal with aliases as above
-RewriteCond %{REQUEST_URI} !^/icons/
-RewriteCond %{REQUEST_URI} !^/cgi-bin/
-RewriteCond ${lowercase:%{SERVER_NAME}} ^(.+)$
+RewriteCond "%{REQUEST_URI}" "!^/icons/"
+RewriteCond "%{REQUEST_URI}" "!^/cgi-bin/"
+RewriteCond "${lowercase:%{SERVER_NAME}}" "^(.+)$"
# this does the file-based remap
-RewriteCond ${vhost:%1} ^(/.*)$
-RewriteRule ^/(.*)$ %1/docs/$1
+RewriteCond "${vhost:%1}" "^(/.*)$"
+RewriteRule "^/(.*)$" "%1/docs/$1"
-RewriteCond %{REQUEST_URI} ^/cgi-bin/
-RewriteCond ${lowercase:%{SERVER_NAME}} ^(.+)$
-RewriteCond ${vhost:%1} ^(/.*)$
-RewriteRule ^/(.*)$ %1/cgi-bin/$1 [H=cgi-script]
+RewriteCond "%{REQUEST_URI}" "^/cgi-bin/"
+RewriteCond "${lowercase:%{SERVER_NAME}}" "^(.+)$"
+RewriteCond "${vhost:%1}" "^(/.*)$"
+RewriteRule "^/(.*)$" "%1/cgi-bin/$1" [H=cgi-script]
</highlight>
</section>