From: Rich Bowen Date: Wed, 20 May 2026 20:52:26 +0000 (+0000) Subject: rewrite: warn that // silently switch to per-directory context X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=73adbe67912c340afb124e537fb7d5e1ee033995;p=thirdparty%2Fapache%2Fhttpd.git rewrite: warn that // silently switch to per-directory context git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1934451 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/docs/manual/rewrite/htaccess.xml b/docs/manual/rewrite/htaccess.xml index 143ed3fae7..5db5037db3 100644 --- a/docs/manual/rewrite/htaccess.xml +++ b/docs/manual/rewrite/htaccess.xml @@ -317,6 +317,23 @@ unsupported and should never be necessary. Relative substitutions, in particular, are likely to break in these contexts.

+These containers silently change rewrite +behavior +

Placing a RewriteRule +inside a Directory, +If, or +Location block +— even inside a +VirtualHost in the +main server config — silently switches to +per-directory context behavior. +This means the leading slash is stripped from the URL before pattern +matching, substitutions trigger an internal redirect (with loop risk), +and the [L] flag no longer +truly stops processing — use +[END] instead.

+
+
Rule inheritance with RewriteOptions diff --git a/docs/manual/rewrite/intro.xml b/docs/manual/rewrite/intro.xml index cb25d1c385..cd6f405559 100644 --- a/docs/manual/rewrite/intro.xml +++ b/docs/manual/rewrite/intro.xml @@ -409,7 +409,11 @@ href="rewritemap.html">RewriteMap supplementary documentation.

but the rules behave differently there — in particular, the directory prefix is stripped from the URL before matching. See the Per-directory Rewrites -document for full details.

+document for full details. Note that +If and +Location blocks +also trigger per-directory behavior — see +Which contexts support rewrite rules?.