httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rbo...@apache.org
Subject svn commit: r421068 - in /httpd/httpd/trunk/docs/manual/rewrite: flags.html.en flags.xml rewrite_intro.html.en rewrite_intro.xml
Date Wed, 12 Jul 2006 01:24:35 GMT
Author: rbowen
Date: Tue Jul 11 18:24:35 2006
New Revision: 421068

URL: http://svn.apache.org/viewvc?rev=421068&view=rev
Log:
Adds more discussion of several rewrite flags.

Modified:
    httpd/httpd/trunk/docs/manual/rewrite/flags.html.en
    httpd/httpd/trunk/docs/manual/rewrite/flags.xml
    httpd/httpd/trunk/docs/manual/rewrite/rewrite_intro.html.en
    httpd/httpd/trunk/docs/manual/rewrite/rewrite_intro.xml

Modified: httpd/httpd/trunk/docs/manual/rewrite/flags.html.en
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/rewrite/flags.html.en?rev=421068&r1=421067&r2=421068&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/rewrite/flags.html.en (original)
+++ httpd/httpd/trunk/docs/manual/rewrite/flags.html.en Tue Jul 11 18:24:35 2006
@@ -114,7 +114,21 @@
 
 
 <h3><a name="flag_f" id="flag_f">F|forbidden</a></h3>
-<p>Forbidden flag</p>
+<p>Using the [F] flag causes Apache to return a 403 Forbidden status
+code to the client. While the same behavior can be accomplished using
+the <code class="directive"><a href="../mod/mod_access.html#deny">Deny</a></code>
directive, this 
+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>
+
+<div class="example"><p><code>
+RewriteRule \.exe - [F]
+</code></p></div>
+
+<p>This rule uses the "-" syntax for the rewrite target, which means
+that the requested URI is not modified.</p>
+
 
 
 <h3><a name="flag_g" id="flag_g">G|gone</a></h3>
@@ -134,7 +148,18 @@
 
 
 <h3><a name="flag_nc" id="flag_nc">NC|nocase</a></h3>
-<p>No case flag</p>
+<p>Use of the [NC] flag causes the <code class="directive"><a href="../mod/mod_rewrite.html#rewriterule">RewriteRule</a></code>
to be matched in a
+case-insensitive manner. That is, it doesn't care whether letters appear
+as upper-case or lower-case in the matched URI.</p>
+
+<p>In the example below, any request for an image file will be proxied
+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>
+
+<div class="example"><p><code>
+RewriteRule (.*\.(jpg|gif|png))$ http://images.example.com$1 [P,NC]
+</code></p></div>
 
 
 <h3><a name="flag_ne" id="flag_ne">NE|noescape</a></h3>
@@ -166,7 +191,26 @@
 
 
 <h3><a name="flag_s" id="flag_s">S|skip</a></h3>
-<p>Skip flag</p>
+<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>
+RewriteCond %{REQUEST_FILENAME} !-f<br />
+RewriteCond %{REQUEST_FILENAME} !-d<br />
+RewriteRule .? - [S=2]<br />
+<br />
+RewriteRule (.*\.gif) images.php?$1<br />
+RewriteRule (.*\.html) docs.php?$1
+</code></p></div>
+
+<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
+following it. Thus, if you want to make a <code>RewriteCond</code> apply
+to several <code>RewriteRule</code>s, one possible technique is to
+negate those conditions and use a [Skip] flag.</p>
+
 
 
 <h3><a name="flag_t" id="flag_t">T|type</a></h3>

Modified: httpd/httpd/trunk/docs/manual/rewrite/flags.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/rewrite/flags.xml?rev=421068&r1=421067&r2=421068&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/rewrite/flags.xml (original)
+++ httpd/httpd/trunk/docs/manual/rewrite/flags.xml Tue Jul 11 18:24:35 2006
@@ -122,7 +122,21 @@
 </section>
 
 <section id="flag_f"><title>F|forbidden</title>
-<p>Forbidden flag</p>
+<p>Using the [F] flag causes Apache to return a 403 Forbidden status
+code to the client. While the same behavior can be accomplished using
+the <directive module="mod_access">Deny</directive> directive, this 
+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>
+
+<example>
+RewriteRule \.exe - [F]
+</example>
+
+<p>This rule uses the "-" syntax for the rewrite target, which means
+that the requested URI is not modified.</p>
+
 </section>
 
 <section id="flag_g"><title>G|gone</title>
@@ -142,7 +156,19 @@
 </section>
 
 <section id="flag_nc"><title>NC|nocase</title>
-<p>No case flag</p>
+<p>Use of the [NC] flag causes the <directive
+module="mod_rewrite">RewriteRule</directive> to be matched in a
+case-insensitive manner. That is, it doesn't care whether letters appear
+as upper-case or lower-case in the matched URI.</p>
+
+<p>In the example below, any request for an image file will be proxied
+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>
+
+<example>
+RewriteRule (.*\.(jpg|gif|png))$ http://images.example.com$1 [P,NC]
+</example>
 </section>
 
 <section id="flag_ne"><title>NE|noescape</title>
@@ -174,7 +200,28 @@
 </section>
 
 <section id="flag_s"><title>S|skip</title>
-<p>Skip flag</p>
+<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>
+RewriteCond %{REQUEST_FILENAME} !-f<br />
+RewriteCond %{REQUEST_FILENAME} !-d<br />
+RewriteRule .? - [S=2]<br />
+<br />
+RewriteRule (.*\.gif) images.php?$1<br />
+RewriteRule (.*\.html) docs.php?$1
+</example>
+
+<p>This technique is useful because a <directive
+module="mod_rewrite">RewriteCond</directive> only applies to the
+<directive module="mod_rewrite">RewriteRule</directive> immediately
+following it. Thus, if you want to make a <code>RewriteCond</code> apply
+to several <code>RewriteRule</code>s, one possible technique is to
+negate those conditions and use a [Skip] flag.</p>
+
 </section>
 
 <section id="flag_t"><title>T|type</title>

Modified: httpd/httpd/trunk/docs/manual/rewrite/rewrite_intro.html.en
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/rewrite/rewrite_intro.html.en?rev=421068&r1=421067&r2=421068&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/rewrite/rewrite_intro.html.en (original)
+++ httpd/httpd/trunk/docs/manual/rewrite/rewrite_intro.html.en Tue Jul 11 18:24:35 2006
@@ -145,13 +145,25 @@
 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif"
/></a></div>
 <div class="section">
 <h2><a name="flags" id="flags">Rewrite Flags</a></h2>
-<p>Discussion of the flags to RewriteRule, and when and why one might
-use them.</p>
+<p>The behavior of a <code class="directive"><a href="../mod/mod_rewrite.html#rewriterule">RewriteRule</a></code>
can be modified by the
+application of one 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>
+<div class="example"><p><code>
+RewriteRule ^puppy.html smalldog.html [NC]
+</code></p></div>
+
+<p>For more details on the available flags, their meanings, and
+examples, see the <a href="flags.html">Rewrite Flags</a> document.</p>
+
 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif"
/></a></div>
 <div class="section">
 <h2><a name="rewritecond" id="rewritecond">Rewrite conditions</a></h2>
-<p>Discussion of RewriteCond, looping, and other related concepts.
+<p>The <code class="directive"><a href="../mod/mod_rewrite.html#rewritecond">RewriteCond</a></code>
directive
+allows a condition to be applied to a <code class="directive"><a href="../mod/mod_rewrite.html#rewriterule">RewriteRule</a></code>.
 </p>
+
 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif"
/></a></div>
 <div class="section">
 <h2><a name="rewritemap" id="rewritemap">Rewrite maps</a></h2>

Modified: httpd/httpd/trunk/docs/manual/rewrite/rewrite_intro.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/rewrite/rewrite_intro.xml?rev=421068&r1=421067&r2=421068&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/rewrite/rewrite_intro.xml (original)
+++ httpd/httpd/trunk/docs/manual/rewrite/rewrite_intro.xml Tue Jul 11 18:24:35 2006
@@ -148,13 +148,28 @@
 </section>
 
 <section id="flags"><title>Rewrite Flags</title>
-<p>Discussion of the flags to RewriteRule, and when and why one might
-use them.</p>
+<p>The behavior of a <directive
+module="mod_rewrite">RewriteRule</directive> can be modified by the
+application of one 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>
+<example>
+RewriteRule ^puppy.html smalldog.html [NC]
+</example>
+
+<p>For more details on the available flags, their meanings, and
+examples, see the <a href="flags.html">Rewrite Flags</a> document.</p>
+
 </section>
 
+
 <section id="rewritecond"><title>Rewrite conditions</title>
-<p>Discussion of RewriteCond, looping, and other related concepts.
+<p>The <directive module="mod_rewrite">RewriteCond</directive> directive
+allows a condition to be applied to a <directive
+module="mod_rewrite">RewriteRule</directive>.
 </p>
+
 </section>
 
 <section id="rewritemap"><title>Rewrite maps</title>



Mime
View raw message