Commit d5f06152 authored by Daniel Gruno's avatar Daniel Gruno
Browse files

xforms

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@1363365 13f79535-47bb-0310-9956-ffa450edef68
parent ea19e74f
Loading
Loading
Loading
Loading
+80 −74
Original line number Diff line number Diff line
@@ -101,6 +101,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>
@@ -123,22 +126,25 @@ RewriteRule ^/u/<strong>([^/]+)</strong>/?(.*) http://<strong>${users-to-hos
    <dd>
      This is done via the following ruleset:

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


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

+51 −43
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ providing detailed explanations and examples.</p>
<li><img alt="" src="../images/down.gif" /> <a href="#flag_r">R|redirect</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#flag_s">S|skip</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#flag_t">T|type</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><li><a href="avoid.html">When not to use mod_rewrite</a></li></ul><ul class="seealso"><li><a href="#comments_section">Comments</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><li><a href="avoid.html">When not to use mod_rewrite</a></li></ul><ul class="seealso"><li><a href="#comments_section">Comments</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="introduction" id="introduction">Introduction</a></h2>
@@ -89,15 +89,22 @@ so backreferences will be 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>

<div class="example"><p><code>
RewriteRule ^(/.*)$ /index.php?show=$1
</code></p></div>
<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
'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>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>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 <code class="directive"><a href="../mod/core.html#allowencodedslashes">AllowEncodedSlashes</a></code> 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>
@@ -141,7 +148,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
@@ -587,21 +593,23 @@ 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. 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 actual file.</p>

<div class="example"><p><code>
# 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 <code class="directive"><a href="../mod/mod_rewrite.html#rewriterule">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
# If so, skip these two RewriteRules
RewriteRule .? - [S=2]
RewriteRule (.*\.gif) images.php?$1
RewriteRule (.*\.html) docs.php?$1
</code></p></div>
</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
<code class="directive"><a href="../mod/mod_rewrite.html#rewriterule">RewriteRule</a></code> immediately
+1 −1
Original line number Diff line number Diff line
<?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: 1307737:1346292 (outdated) -->
<!-- English Revision: 1307737:1363364 (outdated) -->
<!-- French translation : Lucien GENTIS -->
<!-- Reviewed by : Vincent Deffontaines -->

+23 −13
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ but this doc should help the beginner get their feet wet.
<li><img alt="" src="../images/down.gif" /> <a href="#rewritecond">Rewrite Conditions</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#rewritemap">Rewrite maps</a></li>
<li><img alt="" src="../images/down.gif" /> <a href="#htaccess">.htaccess files</a></li>
</ul><h3>See also</h3><ul class="seealso"><li><a href="../mod/mod_rewrite.html">Module documentation</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><li><a href="avoid.html">When not to use mod_rewrite</a></li></ul><ul class="seealso"><li><a href="#comments_section">Comments</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="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><li><a href="avoid.html">When not to use mod_rewrite</a></li></ul><ul class="seealso"><li><a href="#comments_section">Comments</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="introduction" id="introduction">Introduction</a></h2>
@@ -141,14 +141,19 @@ 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" alt="Flow of RewriteRule and RewriteCond matching" /><br />
      <dfn>Figure 1:</dfn> The back-reference flow through a rule.
      <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.<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>


@@ -163,10 +168,15 @@ 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 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" alt="Syntax of the RewriteRule directive" /><br />
+2 −0
Original line number Diff line number Diff line
@@ -24,6 +24,8 @@
<p><span>Langues Disponibles: </span><a href="../en/rewrite/intro.html" hreflang="en" rel="alternate" title="English">&nbsp;en&nbsp;</a> |
<a href="../fr/rewrite/intro.html" title="Français">&nbsp;fr&nbsp;</a></p>
</div>
<div class="outofdate">Cette traduction peut être périmée. Vérifiez la version
            anglaise pour les changements récents.</div>

<p>Ce document est un complément à la <a href="../mod/mod_rewrite.html">documentation de référence</a> du module
<code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>. Il décrit les concepts de base dont la
Loading