diff --git a/CHANGES b/CHANGES index cf7ebfc03ab..ffd8cfba1cb 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,10 @@ -*- coding: utf-8 -*- Changes with Apache 2.4.63 + *) mod_rewrite: Don't require [UNC] flag to preserve a leading // + added by applying the perdir prefix to the substitution. + [Ruediger Pluem, Eric Covener] + *) Windows: Restore the ability to "Include" configuration files on UNC paths. PR69313 [Eric Covener] diff --git a/modules/mappers/mod_rewrite.c b/modules/mappers/mod_rewrite.c index 24e21c6f4dc..ef3e52fb794 100644 --- a/modules/mappers/mod_rewrite.c +++ b/modules/mappers/mod_rewrite.c @@ -4322,6 +4322,7 @@ static rule_return_type apply_rewrite_rule(rewriterule_entry *p, char *newuri = NULL; request_rec *r = ctx->r; int is_proxyreq = 0; + int prefix_added = 0; ctx->uri = r->filename; @@ -4483,6 +4484,7 @@ static rule_return_type apply_rewrite_rule(rewriterule_entry *p, newuri, ctx->perdir, newuri); newuri = apr_pstrcat(r->pool, ctx->perdir, newuri, NULL); + prefix_added = 1; } else if (!(p->flags & (RULEFLAG_PROXY | RULEFLAG_FORCEREDIRECT))) { /* Not an absolute URI-path and the scheme (if any) is unknown, @@ -4496,6 +4498,7 @@ static rule_return_type apply_rewrite_rule(rewriterule_entry *p, newuri, newuri); newuri = apr_pstrcat(r->pool, "/", newuri, NULL); + prefix_added = 1; } } @@ -4576,7 +4579,7 @@ static rule_return_type apply_rewrite_rule(rewriterule_entry *p, return RULE_RC_MATCH; } - if (!(p->flags & RULEFLAG_UNC)) { + if (!((p->flags & RULEFLAG_UNC) || prefix_added)) { /* merge leading slashes, unless they were literals in the sub */ if (!AP_IS_SLASH(p->output[0]) || !AP_IS_SLASH(p->output[1])) { while (AP_IS_SLASH(r->filename[0]) &&