From: Rich Bowen Date: Tue, 16 Jun 2026 15:09:59 +0000 (+0000) Subject: docs: Add [L] flag looping flowchart to rewrite/htaccess.xml X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=14f18517a99aa1fc0a9e496459c0bb2e9bc9f02c;p=thirdparty%2Fapache%2Fhttpd.git docs: Add [L] flag looping flowchart to rewrite/htaccess.xml New diagram illustrating how [L] in per-directory context triggers an internal subrequest that re-enters the ruleset, potentially causing infinite loops. Shows the [END] flag exit path, the condition-guard exit path, and the unguarded loop that results in a 500 error. SVG source and PNG placed in docs/manual/images/. Image referenced from the "The [L] flag and looping" section of htaccess.xml using the same figure markup pattern as existing tech.xml diagrams. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1935412 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/docs/manual/images/rewrite_l_flag_looping.png b/docs/manual/images/rewrite_l_flag_looping.png new file mode 100644 index 0000000000..47aabf8b63 Binary files /dev/null and b/docs/manual/images/rewrite_l_flag_looping.png differ diff --git a/docs/manual/images/rewrite_l_flag_looping.svg b/docs/manual/images/rewrite_l_flag_looping.svg new file mode 100644 index 0000000000..bee5740c4f --- /dev/null +++ b/docs/manual/images/rewrite_l_flag_looping.svg @@ -0,0 +1,153 @@ + + + + + + + + + + Per-Directory Rewriting: [L] Flag Looping + + + + Request: /app/hello + + + + + Per-directory rules (.htaccess) — one pass + + + + Strip directory prefix + + + Pattern sees: "hello" + + + + + Get next rule + + + + + Pattern + matches? + + + + No + + + + Yes + + + + Conditions + met? + + + + No + + + + Yes + + + + Substitute URL / filename + + + + + [END] flag? + + + + Yes + + Done + + + + No + + + + + + + + + [L] or end + of rules? + + + More rules + + + + + [L] stops pass + + + + Internal subrequest with + rewritten URL + + + + + Same rule + matches again? + + + + No + + Done + + + + Yes + + + + Guarded by + RewriteCond? + + + + Yes — cond + fails 2nd pass + + Done + + + + No + + Infinite loop! + (500 error after 10 cycles) + + diff --git a/docs/manual/rewrite/htaccess.xml b/docs/manual/rewrite/htaccess.xml index 5db5037db3..78a57d8ca6 100644 --- a/docs/manual/rewrite/htaccess.xml +++ b/docs/manual/rewrite/htaccess.xml @@ -215,6 +215,14 @@ After the substitution is made, Apache re-processes the request from the top - including re-applying the .htaccess rules. This can lead to infinite loops.

+

+ Flowchart showing how the [L] flag causes looping in
+          per-directory context by triggering a subrequest that
+          re-enters the ruleset
+ Figure: Per-directory [L] flag looping behavior +

+

Consider this rule: