]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
don't add / to / in the non-perdir
authorEric Covener <covener@apache.org>
Wed, 26 Jun 2024 10:27:30 +0000 (10:27 +0000)
committerEric Covener <covener@apache.org>
Wed, 26 Jun 2024 10:27:30 +0000 (10:27 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1918652 13f79535-47bb-0310-9956-ffa450edef68

modules/mappers/mod_rewrite.c

index 2e7d18cc6052703f1c514446bae4b5e3c72d3135..7c965a2ed4f78c7ae7c2ea439bb8da6527a94965 100644 (file)
@@ -4408,17 +4408,13 @@ static rule_return_type apply_rewrite_rule(rewriterule_entry *p,
      */
     if (!is_proxyreq
         && !is_absolute_path(newuri)
+        && !AP_IS_SLASH(*newuri)
         && !is_absolute_uri(newuri, NULL)) {
         if (ctx->perdir) {
-            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);
+            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,