On Wed, Jun 26, 2024 at 6:20 AM Yann Ylavic <ylavic....@gmail.com> wrote: > > On Wed, Jun 26, 2024 at 12:09 PM <cove...@apache.org> wrote: > > > > --- httpd/httpd/trunk/modules/mappers/mod_rewrite.c (original) > > +++ httpd/httpd/trunk/modules/mappers/mod_rewrite.c Wed Jun 26 10:09:29 2024 > > @@ -4413,10 +4410,15 @@ static rule_return_type apply_rewrite_ru > > && !is_absolute_path(newuri) > > && !is_absolute_uri(newuri, NULL)) { > > if (ctx->perdir) { > > - rewritelog(r, 3, ctx->perdir, "add per-dir prefix: %s -> %s%s", > > - newuri, ctx->perdir, newuri); > > + if (!AP_IS_SLASH(*newuri)) { > > + /* perdir, the newuri will be internally redirected, so > > + * leading slash is enough even if it's an ambiguous fs > > path > > + */ > > + rewritelog(r, 3, ctx->perdir, "add per-dir prefix: %s -> > > %s%s", > > + newuri, ctx->perdir, newuri); > > > > - newuri = apr_pstrcat(r->pool, ctx->perdir, newuri, NULL); > > + newuri = apr_pstrcat(r->pool, ctx->perdir, newuri, NULL); > > + } > > } > > else if (!(p->flags & (RULEFLAG_PROXY | RULEFLAG_FORCEREDIRECT))) { > > /* Not an absolute URI-path and the scheme (if any) is unknown, > > Maybe the test for !AP_IS_SLASH() could be moved up (i.e. > !AP_IS_SLASH() && !is_absolute_path()) if we don't want to add a '/' > before anything Windows considers a slash too?
I initially had it, then didn't, But looking again, I guess it is futile to prefix /foo with / anyway and that's all it's gating.