From: Rich Bowen Date: Tue, 16 Jun 2026 16:34:15 +0000 (+0000) Subject: docs: Add path stripping and RewriteBase flowchart to rewrite/htaccess.xml X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=601cf56510213175bb5c74f962cd5b5b9f470e5c;p=thirdparty%2Fapache%2Fhttpd.git docs: Add path stripping and RewriteBase flowchart to rewrite/htaccess.xml New diagram showing the per-directory URL transformation pipeline: incoming URL-path → strip directory prefix → pattern match → substitution → three-way branch depending on result type (relative path gets RewriteBase prepended then subrequest; absolute path goes directly to subrequest; absolute URI triggers external redirect with no subrequest). git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1935417 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/docs/manual/images/rewrite_path_stripping.png b/docs/manual/images/rewrite_path_stripping.png new file mode 100644 index 0000000000..cfc901b09a Binary files /dev/null and b/docs/manual/images/rewrite_path_stripping.png differ diff --git a/docs/manual/images/rewrite_path_stripping.svg b/docs/manual/images/rewrite_path_stripping.svg new file mode 100644 index 0000000000..12d4092407 --- /dev/null +++ b/docs/manual/images/rewrite_path_stripping.svg @@ -0,0 +1,142 @@ + + + + + + + + + + Per-Directory Path Stripping and RewriteBase + + + + Incoming request + + + + + /app/ + products/widget + ← full URL-path + + + + + Strip directory prefix + + + + Prefix = URL path to + .htaccess directory + (here: /app/) + + + + products/widget + ← no leading / + + + + + RewriteRule pattern matches + + + + e.g. RewriteRule "^products/(.+)$" "shop.php?item=$1" + + + + + Apply substitution + + + + + Substitution + type? + + + + http(s):// + + External + redirect + + 302 response + (no subrequest) + + + + starts with / + + + Absolute path: + RewriteBase + not applied + + + + relative + + + + shop.php?item=widget + ← relative + + + + + Prepend RewriteBase + + + + Default: URL path to + .htaccess directory + Or: explicit RewriteBase + + + + /app/ + shop.php?item=widget + ← full path + + + + + Issue internal subrequest + + + + + /app/shop.php?item=widget + + + + + Re-enters request cycle + + + Three possible substitution outcomes: + • Relative (e.g. "shop.php") → RewriteBase prepended → subrequest + • Absolute path (e.g. "/other/page") → used as-is → subrequest + • Absolute URI (e.g. "http://...") → external redirect (no subrequest) + + diff --git a/docs/manual/rewrite/DIAGRAMS.md b/docs/manual/rewrite/DIAGRAMS.md index 4a9eaed1b7..2ee2438743 100644 --- a/docs/manual/rewrite/DIAGRAMS.md +++ b/docs/manual/rewrite/DIAGRAMS.md @@ -175,3 +175,7 @@ What do you want to do? future maintainers can edit them (e.g., Graphviz .dot, or draw.io XML). - Label simplified diagrams explicitly as overviews and link to the authoritative technical page. + +See README.md in ../images for more detail on format, fonts, colors, +etc. + diff --git a/docs/manual/rewrite/htaccess.xml b/docs/manual/rewrite/htaccess.xml index 78a57d8ca6..00bbe7a4cd 100644 --- a/docs/manual/rewrite/htaccess.xml +++ b/docs/manual/rewrite/htaccess.xml @@ -101,6 +101,16 @@ In .htaccess context, the directory prefix is products/widget - no leading slash, no /app/ prefix.

+

+ Flowchart showing the path stripping, substitution,
+          and RewriteBase pipeline in per-directory context, with
+          three outcomes: relative path (RewriteBase prepended),
+          absolute path (used as-is), and absolute URI (external
+          redirect)
+ Figure: Per-directory path stripping and RewriteBase pipeline +

+

This means you must write your patterns differently depending on where the rule lives: