From: Rich Bowen Date: Tue, 16 Jun 2026 18:16:02 +0000 (+0000) Subject: docs: Add module processing order diagram to rewrite/tech.xml X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=07feeac691119094be19aa0e3ec787bd1d818075;p=thirdparty%2Fapache%2Fhttpd.git docs: Add module processing order diagram to rewrite/tech.xml Side-by-side comparison showing the order reversal between server and per-directory context: mod_rewrite runs before mod_alias in server context (both in URL-to-filename phase), but mod_alias runs first in per-directory context because mod_rewrite moves to the later Fixup phase. Color-coded boxes make the reversal immediately visible. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1935430 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/docs/manual/images/rewrite_module_order.png b/docs/manual/images/rewrite_module_order.png new file mode 100644 index 0000000000..fdde07ddc1 Binary files /dev/null and b/docs/manual/images/rewrite_module_order.png differ diff --git a/docs/manual/images/rewrite_module_order.svg b/docs/manual/images/rewrite_module_order.svg new file mode 100644 index 0000000000..bca2266c9a --- /dev/null +++ b/docs/manual/images/rewrite_module_order.svg @@ -0,0 +1,110 @@ + + + + + + + + + + Module Processing Order: mod_rewrite vs mod_alias + + + + + + + Server / VirtualHost Context + + + + Request arrives + + + + + URL-to-filename translation phase + + + + + mod_rewrite + ← FIRST + + + + + mod_alias + second + + + + RewriteRule matches first. + If it rewrites, Redirect + never sees the request. + + + + + Content + + + + Per-Directory Context + (.htaccess / <Directory>) + + + + Request arrives + + + + + URL-to-filename translation phase + + + + + mod_alias + ← FIRST + + + + + Fixup phase (later) + + + + + mod_rewrite + second + + + + Redirect runs first. + If it matches, RewriteRule + in .htaccess never fires. + + + + + Content + + + The order reversal between contexts is a common source of confusion. Choose one module per task. + + diff --git a/docs/manual/rewrite/tech.xml b/docs/manual/rewrite/tech.xml index 8230bd5c6d..7ce37487f4 100644 --- a/docs/manual/rewrite/tech.xml +++ b/docs/manual/rewrite/tech.xml @@ -100,6 +100,17 @@ and URL matching.

the URL-path (or returns a redirect), Redirect never sees the request.

+

+ Side-by-side comparison of module processing order:
+          in server context, mod_rewrite runs first in the
+          URL-to-filename phase then mod_alias runs second; in
+          per-directory context, mod_alias runs first in the
+          URL-to-filename phase, then mod_rewrite runs later in the
+          Fixup phase
+ Figure: Module processing order reversal between server and per-directory context +

+ # In this configuration, the Redirect is never reached for /old # because the RewriteRule matches first — even though