From f7d8729d4eded7f21c1609c4698d97dd82e69cf4 Mon Sep 17 00:00:00 2001
From: Eric Covener
Date: Fri, 13 Nov 2026 13:14:47 -0500
Subject: [PATCH] clarify what UnsafeAllow3F covers (#1023)
it is about path truncation, not the presence of %3F
[skip CI]
(cherry picked from commit 19619a248c8f60c086154710147462a1577e8dcd)
---
docs/manual/rewrite/flags.xml | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/docs/manual/rewrite/flags.xml b/docs/manual/rewrite/flags.xml
index 7793ff64296..adc1008df91 100644
--- a/docs/manual/rewrite/flags.xml
+++ b/docs/manual/rewrite/flags.xml
@@ -1154,15 +1154,15 @@ The L flag can be useful in this context to end the
UnsafeAllow3F
Setting this flag is required to allow a rewrite to continue If the
HTTP request being written has an encoded question mark, '%3f', and the
- rewritten result has a '?' in the substitution. This protects from a malicious
+ rewritten result has a '?' in cases where the first question mark
+ would be interpreted as separating the substituted path from the substituted
+ query. This protects from a malicious
URL taking advantage of a capture and re-substitution of the encoded
- question mark.
+ question mark to truncate the path.
-# A PHP front controller that routes all requests via a query parameter.
-# Without UnsafeAllow3F, a request like /page%3Fname=test would return
-# 403 Forbidden because the rewritten substitution contains '?' while
-# the original request contains an encoded '%3F'.
+# Without UnsafeAllow3F, a request like /page%3Fname=test would be
+# rejected because the path would be truncated.
RewriteCond "%{REQUEST_FILENAME}" !-f
RewriteCond "%{REQUEST_FILENAME}" !-d
RewriteRule "(.+)" "index.php?route=$1" [L,QSA,UnsafeAllow3F]