From: Rich Bowen Date: Mon, 11 May 2026 16:29:45 +0000 (+0000) Subject: Rewrite guide: trim [L] flag section, eliminate looping duplication X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=967221238d2e8185f5f68e252eee2d027348ff83;p=thirdparty%2Fapache%2Fhttpd.git Rewrite guide: trim [L] flag section, eliminate looping duplication The [L] section in flags.xml spent 4 paragraphs re-explaining the per-directory looping behavior that is covered definitively in htaccess.xml#loops. Replace with a 3-line summary and cross-references to [END] and the Per-directory Rewrites document.Rewrite guide: trim [L] flag section, eliminate looping duplication The [L] section in flags.xml spent 4 paragraphs re-explaining the per-directory looping behavior that is covered definitively in htaccess.xml#loops. Replace with a 3-line summary and cross-references to [END] and the Per-directory Rewrites document. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1934106 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/docs/manual/rewrite/TODO.md b/docs/manual/rewrite/TODO.md index 55c75c55ad..338e2dbce3 100644 --- a/docs/manual/rewrite/TODO.md +++ b/docs/manual/rewrite/TODO.md @@ -10,7 +10,7 @@ result in one file "owning" the content and others cross-referencing it. tables in tech.xml and htaccess.xml. → htaccess.xml owns it; others get a brief mention + xref. -- [ ] **[L] vs [END] looping** fully described in three places +- [x] **[L] vs [END] looping** fully described in three places (htaccess.xml, plus both the [L] and [END] sections of flags.xml). → htaccess.xml owns the full explanation; flags.xml slims down + xrefs. diff --git a/docs/manual/rewrite/flags.xml b/docs/manual/rewrite/flags.xml index a28039ff3c..96f03a2f5f 100644 --- a/docs/manual/rewrite/flags.xml +++ b/docs/manual/rewrite/flags.xml @@ -479,32 +479,12 @@ further rules will be processed. This corresponds to the C. Use this flag to indicate that the current rule should be applied immediately without considering further rules.

-

If you are using RewriteRule in either -.htaccess files or in -Directory sections, -it is important to have some understanding of how the rules are -processed. The simplified form of this is that once the rules have been -processed, the rewritten request is handed back to the URL parsing -engine to do what it may with it. It is possible that as the rewritten -request is handled, the .htaccess file or -Directory section -may be encountered again, and thus the ruleset may be run again from the -start. Most commonly this will happen if one of the rules causes a -redirect - either internal or external - causing the request process to -start over.

- -

It is therefore important, if you are using RewriteRule directives in one of these -contexts, that you take explicit steps to avoid rules looping, and not -count solely on the [L] flag to terminate execution of a series of -rules, as shown below.

- -

An alternative flag, [END], can be used to terminate not only the -current round of rewrite processing but prevent any subsequent -rewrite processing from occurring in per-directory (htaccess) -context. This does not apply to new requests resulting from external -redirects.

+

In per-directory context, +[L] stops the current pass through the ruleset, but the rewritten +request may be re-processed from the top — which can cause loops. +Use the [END] flag to prevent this, or see +the Per-directory Rewrites document +for a full discussion of the issue and alternative solutions.

The example given here will rewrite any request to index.php, giving the original request as a query string