From 8e8de3b6ad9bc4f0caa48d9f33e4c602fc0ee904 Mon Sep 17 00:00:00 2001 From: Daniel Gruno <humbedooh@apache.org> Date: Sat, 31 Mar 2012 08:10:47 +0000 Subject: [PATCH] Rebuild git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1307734 13f79535-47bb-0310-9956-ffa450edef68 --- docs/manual/rewrite/flags.html.en | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/docs/manual/rewrite/flags.html.en b/docs/manual/rewrite/flags.html.en index 2401b40da5..68625eaaa0 100644 --- a/docs/manual/rewrite/flags.html.en +++ b/docs/manual/rewrite/flags.html.en @@ -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> -- 2.40.0