diff --git a/changes-entries/pr66672.txt b/changes-entries/pr66672.txt new file mode 100644 index 00000000000..f36897bb0d2 --- /dev/null +++ b/changes-entries/pr66672.txt @@ -0,0 +1,3 @@ + *) mod_rewrite: Fix a recent regression where a rule with both a trailing + '?' and the [QSA] flag did not have the query appended. PR66672 + Frank Meier diff --git a/modules/mappers/mod_rewrite.c b/modules/mappers/mod_rewrite.c index 827239d9dbf..7fb4e92c0de 100644 --- a/modules/mappers/mod_rewrite.c +++ b/modules/mappers/mod_rewrite.c @@ -3909,9 +3909,12 @@ static const char *cmd_rewriterule(cmd_parms *cmd, void *in_dconf, } if (*(a2_end-1) == '?') { - /* a literal ? at the end of the unsubstituted rewrite rule */ - newrule->flags |= RULEFLAG_QSNONE; *(a2_end-1) = '\0'; /* trailing ? has done its job */ + /* a literal ? at the end of the unsubstituted rewrite rule */ + if (!(newrule->flags & RULEFLAG_QSAPPEND)) + { + newrule->flags |= RULEFLAG_QSNONE; + } } else if (newrule->flags & RULEFLAG_QSDISCARD) { if (NULL == ap_strchr(newrule->output, '?')) {