You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by hu...@apache.org on 2012/07/19 17:07:15 UTC

svn commit: r1363364 - in /httpd/httpd/branches/2.2.x/docs/manual/rewrite: advanced.xml flags.xml intro.xml

Author: humbedooh
Date: Thu Jul 19 15:07:15 2012
New Revision: 1363364

URL: http://svn.apache.org/viewvc?rev=1363364&view=rev
Log:
Backport some changes from 2.4 to 2.2, as they are also valid here.

Modified:
    httpd/httpd/branches/2.2.x/docs/manual/rewrite/advanced.xml
    httpd/httpd/branches/2.2.x/docs/manual/rewrite/flags.xml
    httpd/httpd/branches/2.2.x/docs/manual/rewrite/intro.xml

Modified: httpd/httpd/branches/2.2.x/docs/manual/rewrite/advanced.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/docs/manual/rewrite/advanced.xml?rev=1363364&r1=1363363&r2=1363364&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/docs/manual/rewrite/advanced.xml (original)
+++ httpd/httpd/branches/2.2.x/docs/manual/rewrite/advanced.xml Thu Jul 19 15:07:15 2012
@@ -27,8 +27,8 @@
 
 <summary>
 
-<p>This document supplements the <module>mod_rewrite</module> 
-<a href="../mod/mod_rewrite.html">reference documentation</a>. It provides 
+<p>This document supplements the <module>mod_rewrite</module>
+<a href="../mod/mod_rewrite.html">reference documentation</a>. It provides
 a few advanced techniques and tricks using mod_rewrite.</p>
 
 <note type="warning">Note that many of these examples won't work unchanged in your
@@ -55,8 +55,8 @@ configuration.</note>
     <dt>Description:</dt>
 
     <dd>
-      <p>A common technique for distributing the burden of 
-      server load or storage space is called "sharding". 
+      <p>A common technique for distributing the burden of
+      server load or storage space is called "sharding".
       When using this method, a front-end server will use the
       url to consistently "shard" users or objects to separate
       backend servers.</p>
@@ -102,6 +102,9 @@ RewriteRule   ^/u/<strong>([^/]+)</stron
     </dd>
   </dl>
 
+  <p>See the <directive module="mod_rewrite">RewriteMap</directive>
+  documentation for more discussion of the syntax of this directive.</p>
+
 </section>
 
 <section id="on-the-fly-content">
@@ -124,22 +127,24 @@ RewriteRule   ^/u/<strong>([^/]+)</stron
     <dd>
       This is done via the following ruleset:
 
-<example>
-# This example is valid in per-directory context only<br />
-RewriteCond %{REQUEST_FILENAME}   <strong>!-s</strong><br />
-RewriteRule ^page\.<strong>html</strong>$          page.<strong>cgi</strong>   [T=application/x-httpd-cgi,L]
-</example>
-
-      <p>Here a request for <code>page.html</code> leads to an
-      internal run of a corresponding <code>page.cgi</code> if
-      <code>page.html</code> is missing or has filesize
-      null. The trick here is that <code>page.cgi</code> is a
-      CGI script which (additionally to its <code>STDOUT</code>)
-      writes its output to the file <code>page.html</code>.
-      Once it has completed, the server sends out
-      <code>page.html</code>. When the webmaster wants to force
-      a refresh of the contents, he just removes
-      <code>page.html</code> (typically from <code>cron</code>).</p>
+<highlight language="config">
+# This example is valid in per-directory context only
+RewriteCond %{REQUEST_URI}   !-U
+RewriteRule ^(.+)\.html$          /regenerate_page.cgi   [PT,L]
+</highlight>
+
+    <p>The <code>-U</code> operator determines whether the test string
+    (in this case, <code>REQUEST_URI</code>) is a valid URL. It does
+    this via a subrequest. In the event that this subrequest fails -
+    that is, the requested resource doesn't exist - this rule invokes
+    the CGI program <code>/regenerate_page.cgi</code>, which generates
+    the requested resource and saves it into the document directory, so
+    that the next time it is requested, a static copy can be served.</p>
+
+    <p>In this way, documents that are infrequently updated can be served in
+    static form. if documents need to be refreshed, they can be deleted
+    from the document directory, and they will then be regenerated the
+    next time they are requested.</p>
     </dd>
   </dl>
 
@@ -247,61 +252,61 @@ RewriteRule   ^(/[uge]/[^/]+/?.*):refres
 $| = 1;
 
 #   split the QUERY_STRING variable
-@pairs = split(/&amp;/, $ENV{'QUERY_STRING'});
+@pairs = split( /&amp;/, $ENV{'QUERY_STRING'} );
 foreach $pair (@pairs) {
-($name, $value) = split(/=/, $pair);
-$name =~ tr/A-Z/a-z/;
-$name = 'QS_' . $name;
-$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
-eval "\$$name = \"$value\"";
-}
-$QS_s = 1 if ($QS_s eq '');
-$QS_n = 3600 if ($QS_n eq '');
-if ($QS_f eq '') {
-print "HTTP/1.0 200 OK\n";
-print "Content-type: text/html\n\n";
+    ( $name, $value ) = split( /=/, $pair );
+    $name =~ tr/A-Z/a-z/;
+    $name = 'QS_' . $name;
+    $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
+    eval "\$$name = \"$value\"";
+}
+$QS_s = 1    if ( $QS_s eq '' );
+$QS_n = 3600 if ( $QS_n eq '' );
+if ( $QS_f eq '' ) {
+    print "HTTP/1.0 200 OK\n";
+    print "Content-type: text/html\n\n";
 print "&amp;lt;b&amp;gt;ERROR&amp;lt;/b&amp;gt;: No file given\n";
-exit(0);
+    exit(0);
 }
-if (! -f $QS_f) {
-print "HTTP/1.0 200 OK\n";
-print "Content-type: text/html\n\n";
+if ( !-f $QS_f ) {
+    print "HTTP/1.0 200 OK\n";
+    print "Content-type: text/html\n\n";
 print "&amp;lt;b&amp;gt;ERROR&amp;lt;/b&amp;gt;: File $QS_f not found\n";
-exit(0);
+    exit(0);
 }
 
 sub print_http_headers_multipart_begin {
-print "HTTP/1.0 200 OK\n";
-$bound = "ThisRandomString12345";
-print "Content-type: multipart/x-mixed-replace;boundary=$bound\n";
-&amp;print_http_headers_multipart_next;
+    print "HTTP/1.0 200 OK\n";
+    $bound = "ThisRandomString12345";
+    print "Content-type: multipart/x-mixed-replace;boundary=$bound\n";
+    &amp;print_http_headers_multipart_next;
 }
 
 sub print_http_headers_multipart_next {
-print "\n--$bound\n";
+    print "\n--$bound\n";
 }
 
 sub print_http_headers_multipart_end {
-print "\n--$bound--\n";
+    print "\n--$bound--\n";
 }
 
 sub displayhtml {
-local($buffer) = @_;
-$len = length($buffer);
-print "Content-type: text/html\n";
-print "Content-length: $len\n\n";
-print $buffer;
+    local ($buffer) = @_;
+    $len = length($buffer);
+    print "Content-type: text/html\n";
+    print "Content-length: $len\n\n";
+    print $buffer;
 }
 
 sub readfile {
-local($file) = @_;
-local(*FP, $size, $buffer, $bytes);
-($x, $x, $x, $x, $x, $x, $x, $size) = stat($file);
-$size = sprintf("%d", $size);
+    local ($file) = @_;
+    local ( *FP, $size, $buffer, $bytes );
+    ( $x, $x, $x, $x, $x, $x, $x, $size ) = stat($file);
+    $size = sprintf( "%d", $size );
 open(FP, "&amp;lt;$file");
-$bytes = sysread(FP, $buffer, $size);
-close(FP);
-return $buffer;
+    $bytes = sysread( FP, $buffer, $size );
+    close(FP);
+    return $buffer;
 }
 
 $buffer = &amp;readfile($QS_f);
@@ -309,30 +314,30 @@ $buffer = &amp;readfile($QS_f);
 &amp;displayhtml($buffer);
 
 sub mystat {
-local($file) = $_[0];
-local($time);
+    local ($file) = $_[0];
+    local ($time);
 
-($x, $x, $x, $x, $x, $x, $x, $x, $x, $mtime) = stat($file);
-return $mtime;
+    ( $x, $x, $x, $x, $x, $x, $x, $x, $x, $mtime ) = stat($file);
+    return $mtime;
 }
 
 $mtimeL = &amp;mystat($QS_f);
-$mtime = $mtime;
-for ($n = 0; $n &amp;lt; $QS_n; $n++) {
-while (1) {
-    $mtime = &amp;mystat($QS_f);
-    if ($mtime ne $mtimeL) {
-        $mtimeL = $mtime;
-        sleep(2);
-        $buffer = &amp;readfile($QS_f);
-        &amp;print_http_headers_multipart_next;
-        &amp;displayhtml($buffer);
-        sleep(5);
-        $mtimeL = &amp;mystat($QS_f);
-        last;
+$mtime  = $mtime;
+for ( $n = 0 ; $n &amp; lt ; $QS_n ; $n++ ) {
+    while (1) {
+        $mtime = &amp;mystat($QS_f);
+        if ( $mtime ne $mtimeL ) {
+            $mtimeL = $mtime;
+            sleep(2);
+            $buffer = &amp;readfile($QS_f);
+            &amp;print_http_headers_multipart_next;
+            &amp;displayhtml($buffer);
+            sleep(5);
+            $mtimeL = &amp;mystat($QS_f);
+            last;
+        }
+        sleep($QS_s);
     }
-    sleep($QS_s);
-}
 }
 
 &amp;print_http_headers_multipart_end;
@@ -401,7 +406,7 @@ RewriteRule   ^/~(<strong>([a-z])</stron
     </dd>
 
     <dt>Discussion:</dt>
-    <dd>This technique will of course also work with other 
+    <dd>This technique will of course also work with other
     special characters that mod_rewrite, by default, URL-encodes.</dd>
   </dl>
 
@@ -490,4 +495,4 @@ RewriteCond %{ENV:rewritten} =1
 
 </section>
 
-</manualpage> 
+</manualpage>

Modified: httpd/httpd/branches/2.2.x/docs/manual/rewrite/flags.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/docs/manual/rewrite/flags.xml?rev=1363364&r1=1363363&r2=1363364&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/docs/manual/rewrite/flags.xml (original)
+++ httpd/httpd/branches/2.2.x/docs/manual/rewrite/flags.xml Thu Jul 19 15:07:15 2012
@@ -38,7 +38,7 @@ providing detailed explanations and exam
 <seealso><a href="vhosts.html">Virtual hosts</a></seealso>
 <seealso><a href="proxy.html">Proxying</a></seealso>
 <seealso><a href="rewritemap.html">Using RewriteMap</a></seealso>
-<seealso><a href="advanced.html">Advanced techniques and tricks</a></seealso>
+<seealso><a href="advanced.html">Advanced techniques</a></seealso>
 <seealso><a href="avoid.html">When not to use mod_rewrite</a></seealso>
 
 <section id="introduction"><title>Introduction</title>
@@ -54,7 +54,7 @@ RewriteRule pattern target [Flag1,Flag2,
 a longer form, such as <code>cookie</code>. Some flags take one or more
 arguments. Flags are not case sensitive.</p>
 
-<p>Each flag (with a few exceptions) 
+<p>Each flag (with a few exceptions)
 has a long and short form. 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.</p>
@@ -79,15 +79,22 @@ so backreferences will be unescaped at t
 Using the B flag, non-alphanumeric characters in backreferences
 will be escaped. For example, consider the rule:</p>
 
-<example>
-RewriteRule ^(/.*)$ /index.php?show=$1
-</example>
+<highlight language="config">RewriteRule ^search/(.*)$ /search.php?term=$1</highlight>
 
-<p>This will map <code>/C++</code> to
-<code>/index.php?show=/C++</code>. But it will also map
-<code>/C%2b%2b</code> to <code>/index.php?show=/C++</code>, because
-the <code>%2b</code> has been unescaped.  With the B flag, it will
-instead map to <code>/index.php?show=/C%2b%2b</code>.</p>
+<p>Given a search term of 'x &amp; y/z', a browser will encode it as
+'x%20%26%20y%2Fz', making the request 'search/x%20%26%20y%2Fz'. Without the B
+flag, this rewrite rule will map to 'search.php?term=x &amp; y/z', which
+isn't a valid URL, and so would be encoded as
+<code>search.php?term=x%20&amp;y%2Fz=</code>, which is not what was intended.</p>
+
+<p>With the B flag set on this same rule, the parameters are re-encoded
+before being passed on to the output URL, resulting in a correct mapping to
+<code>/search.php?term=x%20%26%20y%2Fz</code>.</p>
+
+<p>Note that you may also need to set <directive
+module="core">AllowEncodedSlashes</directive> to <code>On</code> to get this
+particular example to work, as httpd does not allow encoded slashes in URLs, and
+returns a 404 if it sees one.</p>
 
 <p>This escaping is particularly necessary in a proxy situation,
 when the backend may break if presented with an unescaped URL.</p>
@@ -132,7 +139,6 @@ security model.</dd>
 <p>You may optionally also set the following values:</p>
 
 <dl>
-
 <dt>Lifetime</dt>
 <dd>The time for which the cookie will persist, in minutes.</dd>
 <dd>A value of 0 indicates that the cookie will persist only for the
@@ -336,13 +342,13 @@ immediately without considering further 
 
 <p>If you are using <directive
 module="mod_rewrite">RewriteRule</directive> in either
-<code>.htaccess</code> files or in 
+<code>.htaccess</code> files or in
 <directive type="section" module="core">Directory</directive> sections,
 it is important to have some understanding of how the rules are
 processed.  The simplified form of this is that once the rules have been
 processed, the rewritten request is handed back to the URL parsing
 engine to do what it may with it. It is possible that as the rewritten
-request is handled, the <code>.htaccess</code> file or 
+request is handled, the <code>.htaccess</code> file or
 <directive type="section" module="core">Directory</directive> section
 may be encountered again, and thus the ruleset may be run again from the
 start. Most commonly this will happen if one of the rules causes a
@@ -358,7 +364,7 @@ rules, as shown below.</p>
 <p>The example given here will rewrite any request to
 <code>index.php</code>, giving the original request as a query string
 argument to <code>index.php</code>, however, the <directive
-module="mod_rewrite">RewriteCond</directive> ensures that if the request 
+module="mod_rewrite">RewriteCond</directive> ensures that if the request
 is already for <code>index.php</code>, the <directive
 module="mod_rewrite">RewriteRule</directive> will be skipped.</p>
 
@@ -440,7 +446,7 @@ On subrequests, it is not always useful,
 the complete set of rules are applied. Use this flag to exclude
 problematic rules.</p>
 
-<p>To decide whether or not to use this rule: if you prefix URLs with 
+<p>To decide whether or not to use this rule: if you prefix URLs with
 CGI-scripts, to force them to be processed by the CGI-script, it's
 likely that you will run into problems (or significant overhead)
 on sub-requests. In these cases, use this flag.</p>
@@ -499,17 +505,17 @@ use of the [PT] flag causes the result o
 module="mod_rewrite">RewriteRule</directive> to be passed back through
 URL mapping, so that location-based mappings, such as <directive
 module="mod_alias">Alias</directive>, <directive
-module="mod_alias">Redirect</directive>, or <directive 
-module="mod_alias">ScriptAlias</directive>, for example, might have a 
+module="mod_alias">Redirect</directive>, or <directive
+module="mod_alias">ScriptAlias</directive>, for example, might have a
 chance to take effect.
 </p>
 
 <p>
-If, for example, you have an 
+If, for example, you have an
 <directive module="mod_alias">Alias</directive>
 for /icons, and have a <directive
 module="mod_rewrite">RewriteRule</directive> pointing there, you should
-use the [PT] flag to ensure that the 
+use the [PT] flag to ensure that the
 <directive module="mod_alias">Alias</directive> is evaluated.
 </p>
 
@@ -567,8 +573,8 @@ will be used to generate the URL sent wi
 </p>
 
 <p>
-<em>Any</em> valid HTTP response  status code may be specified, 
-using the syntax [R=305], with a 302 status code being used by 
+<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, 
 if a status code is outside the redirect range (300-399) then the
@@ -576,7 +582,7 @@ substitution string is dropped entirely,
 the <code>L</code> were used.</p>
 
 <p>In addition to response status codes, you may also specify redirect
-status using their symbolic names: <code>temp</code> (default), 
+status using their symbolic names: <code>temp</code> (default),
 <code>permanent</code>, or <code>seeother</code>.</p>
 
 <p>
@@ -590,22 +596,22 @@ URI in request' warnings.
 </section>
 
 <section id="flag_s"><title>S|skip</title>
-<p>The [S] flag is used to skip rules that you don't want to run. 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 <directive
-module="mod_rewrite">RewriteRule</directive> if the requested URI
-doesn't correspond with an actual file.</p>
-
-<example>
-# Is the request for a non-existent file?<br />
-RewriteCond %{REQUEST_FILENAME} !-f<br />
-RewriteCond %{REQUEST_FILENAME} !-d<br />
-# If so, skip these two RewriteRules<br />
-RewriteRule .? - [S=2]<br />
-<br />
-RewriteRule (.*\.gif) images.php?$1<br />
+<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. 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 <directive module="mod_rewrite">RewriteRule</directive> if the 
+requested URI doesn't correspond with an actual file.</p>
+
+<highlight language="config">
+# Is the request for a non-existent file?
+RewriteCond %{REQUEST_FILENAME} !-f
+RewriteCond %{REQUEST_FILENAME} !-d
+# If so, skip these two RewriteRules
+RewriteRule .? - [S=2]
+RewriteRule (.*\.gif) images.php?$1
 RewriteRule (.*\.html) docs.php?$1
-</example>
+</highlight>
 
 <p>This technique is useful because a <directive
 module="mod_rewrite">RewriteCond</directive> only applies to the
@@ -625,14 +631,14 @@ RewriteRule .? - [S=3]<br />
 <br />
 # IF the file exists, then:
 <indent>
-	RewriteRule (.*\.gif) images.php?$1<br />
-	RewriteRule (.*\.html) docs.php?$1<br />
-	# Skip past the &quot;else&quot; stanza.<br />
-	RewriteRule .? - [S=1]<br />
+        RewriteRule (.*\.gif) images.php?$1<br />
+        RewriteRule (.*\.html) docs.php?$1<br />
+        # Skip past the &quot;else&quot; stanza.<br />
+        RewriteRule .? - [S=1]<br />
 </indent>
 # ELSE...
 <indent>
-	RewriteRule (.*) 404.php?file=$1<br />
+        RewriteRule (.*) 404.php?file=$1<br />
 </indent>
 # END
 </example>
@@ -668,10 +674,10 @@ invariably be a less efficient solution 
 
 <p>
 If used in per-directory context, use only <code>-</code> (dash)
-as the substitution <em>for the entire round of mod_rewrite processing</em>, 
-otherwise the MIME-type set with this flag is lost due to an internal 
+as the substitution <em>for the entire round of mod_rewrite processing</em>,
+otherwise the MIME-type set with this flag is lost due to an internal
 re-processing (including subsequent rounds of mod_rewrite processing).
-The <code>L</code> flag can be useful in this context to end the 
+The <code>L</code> flag can be useful in this context to end the
 <em>current</em> round of mod_rewrite processing.</p>
 
 </section>

Modified: httpd/httpd/branches/2.2.x/docs/manual/rewrite/intro.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/docs/manual/rewrite/intro.xml?rev=1363364&r1=1363363&r2=1363364&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/docs/manual/rewrite/intro.xml (original)
+++ httpd/httpd/branches/2.2.x/docs/manual/rewrite/intro.xml Thu Jul 19 15:07:15 2012
@@ -41,7 +41,7 @@ but this doc should help the beginner ge
 <seealso><a href="vhosts.html">Virtual hosts</a></seealso>
 <seealso><a href="proxy.html">Proxying</a></seealso>
 <seealso><a href="rewritemap.html">Using RewriteMap</a></seealso>
-<seealso><a href="advanced.html">Advanced techniques and tricks</a></seealso>
+<seealso><a href="advanced.html">Advanced techniques</a></seealso>
 <seealso><a href="avoid.html">When not to use mod_rewrite</a></seealso>
 
 <section id="introduction"><title>Introduction</title>
@@ -107,7 +107,7 @@ well as write your own.</p>
 character</td><td><code>c.t</code> will match <code>cat</code>,
 <code>cot</code>, <code>cut</code>, etc.</td></tr>
 <tr><td><code>+</code></td><td>Repeats the previous match one or more
-times</td><td><code>a+</code> matches <code>a</code>, <code>aa</code>, 
+times</td><td><code>a+</code> matches <code>a</code>, <code>aa</code>,
 <code>aaa</code>, etc</td></tr>
 <tr><td><code>*</code></td><td>Repeats the previous match zero or more
 times.</td><td><code>a*</code> matches all the same things
@@ -122,7 +122,7 @@ of the string</td><td><code>^a</code> ma
 the string.</td><td><code>a$</code> matches a string that ends with
 <code>a</code>.</td></tr>
 <tr><td><code>( )</code></td><td>Groups several characters into a single
-unit, and captures a match for use in a backreference.</td><td><code>(ab)+</code> 
+unit, and captures a match for use in a backreference.</td><td><code>(ab)+</code>
 matches <code>ababab</code> - that is, the <code>+</code> applies to the group.
 For more on backreferences see <a href="#InternalBackRefs">below</a>.</td></tr>
 <tr><td><code>[ ]</code></td><td>A character class - matches one of the
@@ -145,15 +145,20 @@ 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 strings <em>Substitution</em> and <em>TestString</em>.
-      Figure 1 shows to which locations the back-references are
-      transferred for expansion as well as illustrating the flow of the
-      RewriteRule, RewriteCond matching.</p>
+      the strings <em>Substitution</em> and <em>TestString</em> as 
+      outlined in the following chapters. 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>
 
 <p class="figure">
-      <img src="../images/rewrite_rule_flow.png" 
+      <img src="../images/rewrite_backreferences.png"
       alt="Flow of RewriteRule and RewriteCond matching" /><br />
-      <dfn>Figure 1:</dfn> The back-reference flow through a rule.
+      <dfn>Figure 1:</dfn> The back-reference flow through a rule.<br />
+      In this example, a request for <code>/test/1234</code> would be transformed into <code>/admin.foo?page=test&amp;id=1234&amp;host=admin.example.com</code>.
 </p>
 
 </section>
@@ -168,13 +173,18 @@ of three arguments separated by spaces. 
 <li><var>[flags]</var>: options affecting the rewritten request.</li>
 </ol>
 
-<p>The <var>Pattern</var> is always a <a href="#regex">regular
-expression</a> 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).</p>
+<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 
+occured, the rules that follow are matched against the substituted
+value.
+</p>
 
 <p class="figure">
-      <img src="../images/syntax_rewriterule.png" 
+      <img src="../images/syntax_rewriterule.png"
       alt="Syntax of the RewriteRule directive" /><br />
       <dfn>Figure 2:</dfn> Syntax of the RewriteRule directive.
 </p>
@@ -260,7 +270,7 @@ expression</a> that must match the varia
 argument is a list of flags that modify how the match is evaluated.</p>
 
 <p class="figure">
-      <img src="../images/syntax_rewritecond.png" 
+      <img src="../images/syntax_rewritecond.png"
       alt="Syntax of the RewriteCond directive" /><br />
       <dfn>Figure 3:</dfn> Syntax of the RewriteCond directive
 </p>