]> granicus.if.org Git - apache/commitdiff
Rebuild
authorDaniel Gruno <humbedooh@apache.org>
Sat, 31 Mar 2012 08:12:58 +0000 (08:12 +0000)
committerDaniel Gruno <humbedooh@apache.org>
Sat, 31 Mar 2012 08:12:58 +0000 (08:12 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1307736 13f79535-47bb-0310-9956-ffa450edef68

docs/manual/rewrite/flags.html.en

index b7969c3d343487eddd2f938eac6a3ef997ad06c1..906226119ced45b148d3190a499a8d7356fd9f77 100644 (file)
@@ -653,10 +653,31 @@ RewriteRule (.*\.html) docs.php?$1
 <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. So, you can
+negate those conditions and add a <code>RewriteRule</code> with a [Skip] flag. You can
 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>
+number of rules in the else-clause:</p>
+<div class="example"><p><code>
+# Does the file exist?<br />
+RewriteCond %{REQUEST_FILENAME} !-f<br />
+RewriteCond %{REQUEST_FILENAME} !-d<br />
+# Create an if-then-else construct by skipping 3 lines if we meant to go to the "else" stanza.<br />
+RewriteRule .? - [S=3]<br />
+<br />
+# IF the file exists, then:
+<span class="indent">
+       RewriteRule (.*\.gif) images.php?$1<br />
+       RewriteRule (.*\.html) docs.php?$1<br />
+       # Skip past the "else" stanza.<br />
+       RewriteRule .? - [S=1]<br />
+</span>
+# ELSE...
+<span class="indent">
+       RewriteRule (.*) 404.php?file=$1<br />
+</span>
+# END
+</code></p></div>
+
 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
 <div class="section">
 <h2><a name="flag_t" id="flag_t">T|type</a></h2>