Return-Path: X-Original-To: apmail-httpd-docs-archive@www.apache.org Delivered-To: apmail-httpd-docs-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BD556907A for ; Wed, 5 Oct 2011 16:55:07 +0000 (UTC) Received: (qmail 53600 invoked by uid 500); 5 Oct 2011 16:55:07 -0000 Delivered-To: apmail-httpd-docs-archive@httpd.apache.org Received: (qmail 53555 invoked by uid 500); 5 Oct 2011 16:55:07 -0000 Mailing-List: contact docs-help@httpd.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: docs@httpd.apache.org List-Id: Delivered-To: mailing list docs@httpd.apache.org Received: (qmail 53547 invoked by uid 99); 5 Oct 2011 16:55:07 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Oct 2011 16:55:07 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.115] (HELO eir.zones.apache.org) (140.211.11.115) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Oct 2011 16:55:06 +0000 Received: by eir.zones.apache.org (Postfix, from userid 80) id 95FBF4F9A9; Wed, 5 Oct 2011 16:54:45 +0000 (UTC) From: bugzilla@apache.org To: docs@httpd.apache.org Subject: DO NOT REPLY [Bug 51964] New: Documentation of RewriteRule flag skip unclear Date: Wed, 05 Oct 2011 16:54:45 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Apache httpd-2 X-Bugzilla-Component: Documentation X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: chealer@gmail.com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: docs@httpd.apache.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: https://issues.apache.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 https://issues.apache.org/bugzilla/show_bug.cgi?id=51964 Bug #: 51964 Summary: Documentation of RewriteRule flag skip unclear Product: Apache httpd-2 Version: 2.3-HEAD Platform: PC OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: Documentation AssignedTo: docs@httpd.apache.org ReportedBy: chealer@gmail.com Classification: Unclassified The documentation of the skip flag of RewriteRule is unclear: http://httpd.apache.org/docs/current/en/rewrite/flags.html#flag_s The section reads: The [S] flag is used to skip rules that you don't want to run. This can be thought of as a goto statement in your rewrite ruleset. In the following example, we only want to run the RewriteRule if the requested URI doesn't correspond with an actual file. # 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 This technique is useful because a RewriteCond only applies to the RewriteRule immediately following it. Thus, if you want to make a RewriteCond apply to several RewriteRules, one possible technique is to negate those conditions and use a [Skip] flag. So, you can use this to make pseudo if-then-else constructs: The last rule of the then-clause becomes skip=N, where N is the number of rules in the else-clause. Thanks to the example, I'm able to understand how it works. I understand the analogy to goto, although goto-s do not take relative line numbers AFAIK, so this could be clarified. The bit saying that "one possible technique is to negate those conditions and use a [Skip] flag" could be clarified with "one possible technique is to negate those conditions and to add a rule which uses a [Skip] flag". What I find really unclear is the analogy with if-then-else. I understand there are conditions, so I see an equivalent of the if part. If the conditions do not match, an else block is executed, so I see an equivalent here too. But I don't see an equivalent to the then part. I don't understand the sentence "The last rule of the then-clause becomes skip=N, where N is the number of rules in the else-clause." "The last rule of the then-clause becomes skip=N" is very unclear to me. I suggest to add an example analogy to clarify, giving a pseudocode equivalent to the snippet above, saying "If Apache configuration would support if structures, we could have written something like: [...]. Instead, we write: [snippet above]." -- Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: docs-unsubscribe@httpd.apache.org For additional commands, e-mail: docs-help@httpd.apache.org