Commit 4807a1f6 authored by Richard Bowen's avatar Richard Bowen
Browse files

Updates one of the "advanced" recipes and rewrites description.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1169760 13f79535-47bb-0310-9956-ffa450edef68
parent b3ec4d38
Loading
Loading
Loading
Loading
+1 −1
Changes for docs/manual/rewrite/access.html.en: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ configuration.</div>
<li><img alt="" src="../images/down.gif" /> <a href="#blocking-of-robots">Blocking of Robots</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#host-deny">Denying Hosts in a Blacklist</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#referer-deflector">Referer-based Deflector</a></li>
</ul><h3>See also</h3><ul class="seealso"><li><a href="../mod/mod_rewrite.html">Module documentation</a></li><li><a href="intro.html">mod_rewrite introduction</a></li><li><a href="remapping.html">Redirection and remapping</a></li><li><a href="vhosts.html">Virtual hosts</a></li><li><a href="proxy.html">Proxying</a></li><li><a href="rewritemap.html">Using RewriteMap</a></li><li><a href="advanced.html">Advanced techniques and tricks</a></li><li><a href="avoid.html">When not to use mod_rewrite</a></li></ul></div>
</ul><h3>See also</h3><ul class="seealso"><li><a href="../mod/mod_rewrite.html">Module documentation</a></li><li><a href="intro.html">mod_rewrite introduction</a></li><li><a href="remapping.html">Redirection and remapping</a></li><li><a href="vhosts.html">Virtual hosts</a></li><li><a href="proxy.html">Proxying</a></li><li><a href="rewritemap.html">Using RewriteMap</a></li><li><a href="advanced.html">Advanced techniques</a></li><li><a href="avoid.html">When not to use mod_rewrite</a></li></ul></div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
<h2><a name="blocked-inline-images" id="blocked-inline-images">Forbidding Image "Hotlinking"</a></h2>
+1 −1
Changes for docs/manual/rewrite/access.xml: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ configuration.</note>
<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="blocked-inline-images">
+24 −13
Changes for docs/manual/rewrite/advanced.html.en: 24 added lines, 13 removed lines.
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@

<p>This document supplements the <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code> 
<a href="../mod/mod_rewrite.html">reference documentation</a>. It provides 
a few advanced techniques and tricks using mod_rewrite.</p>
a few advanced techniques using mod_rewrite.</p>

<div class="warning">Note that many of these examples won't work unchanged in your
particular server configuration, so it's important that you understand
@@ -98,6 +98,9 @@ RewriteRule ^/u/<strong>([^/]+)</strong>/?(.*) http://<strong>${users-to-hos
    </dd>
  </dl>

  <p>See the <code class="directive"><a href="../mod/mod_rewrite.html#rewritemap">RewriteMap</a></code>
  documentation for more discussion of the syntax of this directive.</p>

</div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
<h2><a name="on-the-fly-content" id="on-the-fly-content">On-the-fly Content-Regeneration</a></h2>
@@ -122,20 +125,22 @@ RewriteRule ^/u/<strong>([^/]+)</strong>/?(.*) http://<strong>${users-to-hos

<div class="example"><p><code>
# 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]
RewriteCond %{REQUEST_URI}   <strong>!-U</strong><br />
RewriteRule ^(.+)\.html$          /regenerate_page.cgi   [PT,L]
</code></p></div>

      <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>
    <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>

@@ -193,6 +198,8 @@ featureful than anything you can cobble together using mod_rewrite.</p>

  



  <dl>
    <dt>Description:</dt>

@@ -480,6 +487,10 @@ RewriteRule ^/horse/(.*) /pony/$1 [E=<strong>rewritten:1</strong>]
RewriteCond %{ENV:rewritten} =1
</code></p></div>

    <p>Note that environment variables do not survive an external
    redirect. You might consider using the [CO] flag to set a
    cookie.</p>

    </dd>
  </dl>

+30 −14
Changes for docs/manual/rewrite/advanced.xml: 30 added lines, 14 removed lines.
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@

<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>
a few advanced techniques using mod_rewrite.</p>

<note type="warning">Note that many of these examples won't work unchanged in your
particular server configuration, so it's important that you understand
@@ -44,7 +44,7 @@ configuration.</note>
<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="sharding">
@@ -102,6 +102,9 @@ RewriteRule ^/u/<strong>([^/]+)</strong>/?(.*) http://<strong>${users-to-hos
    </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">
@@ -126,20 +129,22 @@ RewriteRule ^/u/<strong>([^/]+)</strong>/?(.*) http://<strong>${users-to-hos

<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]
RewriteCond %{REQUEST_URI}   <strong>!-U</strong><br />
RewriteRule ^(.+)\.html$          /regenerate_page.cgi   [PT,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>
    <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>

@@ -198,6 +203,13 @@ featureful than anything you can cobble together using mod_rewrite.</p>

  <title>Document With Autorefresh</title>

<!--
I'm trying to decide whether this example is worthwhile to keep, and, if
so, whether it needs to be updated/rewritten. Certainly the description
needs to be rewritten. I'm not sure we really need to be recommending
nph-refresh techniques.
-->

  <dl>
    <dt>Description:</dt>

@@ -485,6 +497,10 @@ RewriteRule ^/horse/(.*) /pony/$1 [E=<strong>rewritten:1</strong>]
RewriteCond %{ENV:rewritten} =1
</example>

    <p>Note that environment variables do not survive an external
    redirect. You might consider using the [CO] flag to set a
    cookie.</p>

    </dd>
  </dl>

+1 −1
Changes for docs/manual/rewrite/avoid.html.en: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@ files to work with, you may need to resort to
<li><img alt="" src="../images/down.gif" /> <a href="#vhosts">Virtual Hosting</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#proxy">Simple Proxying</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#setenv">Environment Variable Testing</a></li>
</ul><h3>See also</h3><ul class="seealso"><li><a href="../mod/mod_rewrite.html">Module documentation</a></li><li><a href="intro.html">mod_rewrite introduction</a></li><li><a href="remapping.html">Redirection and remapping</a></li><li><a href="access.html">Controlling access</a></li><li><a href="vhosts.html">Virtual hosts</a></li><li><a href="proxy.html">Proxying</a></li><li><a href="rewritemap.html">Using RewriteMap</a></li><li><a href="advanced.html">Advanced techniques and tricks</a></li></ul></div>
</ul><h3>See also</h3><ul class="seealso"><li><a href="../mod/mod_rewrite.html">Module documentation</a></li><li><a href="intro.html">mod_rewrite introduction</a></li><li><a href="remapping.html">Redirection and remapping</a></li><li><a href="access.html">Controlling access</a></li><li><a href="vhosts.html">Virtual hosts</a></li><li><a href="proxy.html">Proxying</a></li><li><a href="rewritemap.html">Using RewriteMap</a></li><li><a href="advanced.html">Advanced techniques</a></li></ul></div>
<div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
<div class="section">
<h2><a name="redirect" id="redirect">Simple Redirection</a></h2>
Loading