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/03/31 10:12:58 UTC

svn commit: r1307736 - /httpd/httpd/branches/2.4.x/docs/manual/rewrite/flags.html.en

Author: humbedooh
Date: Sat Mar 31 08:12:58 2012
New Revision: 1307736

URL: http://svn.apache.org/viewvc?rev=1307736&view=rev
Log:
Rebuild

Modified:
    httpd/httpd/branches/2.4.x/docs/manual/rewrite/flags.html.en

Modified: httpd/httpd/branches/2.4.x/docs/manual/rewrite/flags.html.en
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/docs/manual/rewrite/flags.html.en?rev=1307736&r1=1307735&r2=1307736&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/docs/manual/rewrite/flags.html.en (original)
+++ httpd/httpd/branches/2.4.x/docs/manual/rewrite/flags.html.en Sat Mar 31 08:12:58 2012
@@ -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>