Index: httpd-2.2.34/server/core.c
===================================================================
--- httpd-2.2.34.orig/server/core.c	2019-04-02 17:09:38.424691510 +0200
+++ httpd-2.2.34/server/core.c	2019-04-02 18:01:20.444364680 +0200
@@ -503,6 +503,7 @@ static void *create_core_server_config(a
 #endif
 
     conf->trace_enable = AP_TRACE_UNSET;
+    conf->merge_slashes = AP_CORE_CONFIG_UNSET;
 
     return (void *)conf;
 }
@@ -561,6 +562,10 @@ static void *merge_core_server_configs(a
     if (virt->http_expect_strict != AP_HTTP_EXPECT_STRICT_UNSET)
         conf->http_expect_strict = virt->http_expect_strict;
 
+    conf->merge_slashes = (virt->merge_slashes != AP_CORE_CONFIG_UNSET)
+                         ? virt->merge_slashes
+                         : base->merge_slashes;
+
     /* N.B. If you backport things here from 2.4, note that the
      * merging logic needs to be inverted, since conf is initially a
      * copy of vertv not basev. */
@@ -1463,6 +1468,13 @@ static const char *set_override(cmd_parm
     return NULL;
 }
 
+static const char *set_core_server_flag(cmd_parms *cmd, void *s_, int flag)
+{
+    core_server_config *conf =
+        ap_get_module_config(cmd->server->module_config, &core_module);
+    return ap_set_flag_slot(cmd, conf, flag);
+}
+
 static const char *set_options(cmd_parms *cmd, void *d_, const char *l)
 {
     core_dir_config *d = d_;
@@ -3662,6 +3674,10 @@ AP_INIT_ITERATE("HttpProtocolOptions", s
                 "'Unsafe' or 'Strict' (default). Sets HTTP acceptance rules"),
 AP_INIT_ITERATE("RegisterHttpMethod", set_http_method, NULL, RSRC_CONF,
                 "Registers non-standard HTTP methods"),
+AP_INIT_FLAG("MergeSlashes", set_core_server_flag,
+             (void *)APR_OFFSETOF(core_server_config, merge_slashes),
+             RSRC_CONF,
+             "Controls whether consecutive slashes in the URI path are merged"),
 { NULL }
 };
 
Index: httpd-2.2.34/include/httpd.h
===================================================================
--- httpd-2.2.34.orig/include/httpd.h	2017-01-05 02:57:54.000000000 +0100
+++ httpd-2.2.34/include/httpd.h	2019-04-02 17:09:38.628692506 +0200
@@ -1496,12 +1496,22 @@ AP_DECLARE(int) ap_unescape_url_keep2f(c
 AP_DECLARE(int) ap_unescape_url_keep2f_ex(char *url, int decode_slashes);
 
 /**
- * Convert all double slashes to single slashes
- * @param name The string to convert
+ * Convert all double slashes to single slashes, except where significant
+ * to the filesystem on the current platform.
+ * @param name The string to convert, assumed to be a filesystem path
  */
 AP_DECLARE(void) ap_no2slash(char *name);
 
 /**
+ * Convert all double slashes to single slashes, except where significant
+ * to the filesystem on the current platform.
+ * @param name The string to convert
+ * @param is_fs_path if set to 0, the significance of any double-slashes is
+ *        ignored.
+ */
+AP_DECLARE(void) ap_no2slash_ex(char *name, int is_fs_path);
+
+/**
  * Remove all ./ and xx/../ substrings from a file name. Also remove
  * any leading ../ or /../ substrings.
  * @param name the file name to parse
Index: httpd-2.2.34/include/http_core.h
===================================================================
--- httpd-2.2.34.orig/include/http_core.h	2019-04-02 17:09:38.388691334 +0200
+++ httpd-2.2.34/include/http_core.h	2019-04-02 17:43:12.342943415 +0200
@@ -435,6 +435,10 @@ typedef unsigned long etag_components_t;
 /* This is the default value used */
 #define ETAG_BACKWARD (ETAG_MTIME | ETAG_SIZE)
 
+#define AP_CORE_CONFIG_OFF   (0)
+#define AP_CORE_CONFIG_ON    (1)
+#define AP_CORE_CONFIG_UNSET (2)
+
 /**
  * @brief Server Signature Enumeration
  */
@@ -652,7 +656,7 @@ typedef struct {
 #define AP_HTTP_EXPECT_STRICT_ENABLE   1
 #define AP_HTTP_EXPECT_STRICT_DISABLE  2
     int http_expect_strict;
-
+    unsigned int merge_slashes;
 } core_server_config;
 
 /* for AddOutputFiltersByType in core.c */
Index: httpd-2.2.34/server/util.c
===================================================================
--- httpd-2.2.34.orig/server/util.c	2019-04-02 17:09:38.224690533 +0200
+++ httpd-2.2.34/server/util.c	2019-04-02 17:09:38.628692506 +0200
@@ -541,16 +541,20 @@ AP_DECLARE(void) ap_getparents(char *nam
         name[l] = '\0';
     }
 }
-
-AP_DECLARE(void) ap_no2slash(char *name)
+AP_DECLARE(void) ap_no2slash_ex(char *name, int is_fs_path)
 {
+
     char *d, *s;
 
+    if (!name || !*name) {
+        return;
+    }
+
     s = d = name;
 
 #ifdef HAVE_UNC_PATHS
     /* Check for UNC names.  Leave leading two slashes. */
-    if (s[0] == '/' && s[1] == '/')
+    if (is_fs_path && s[0] == '/' && s[1] == '/')
         *d++ = *s++;
 #endif
 
@@ -567,6 +571,10 @@ AP_DECLARE(void) ap_no2slash(char *name)
     *d = '\0';
 }
 
+AP_DECLARE(void) ap_no2slash(char *name)
+{
+    ap_no2slash_ex(name, 1);
+}
 
 /*
  * copy at most n leading directories of s into d
Index: httpd-2.2.34/server/request.c
===================================================================
--- httpd-2.2.34.orig/server/request.c	2017-06-19 19:01:50.000000000 +0200
+++ httpd-2.2.34/server/request.c	2019-04-02 18:01:46.936493420 +0200
@@ -103,6 +103,8 @@ AP_DECLARE(int) ap_process_request_inter
 {
     int file_req = (r->main && r->filename);
     int access_status;
+    core_server_config *sconf =
+        ap_get_module_config(r->server->module_config, &core_module);
 
     /* Ignore embedded %2F's in path for proxy requests */
     if (!r->proxyreq && r->parsed_uri.path) {
@@ -128,6 +130,12 @@ AP_DECLARE(int) ap_process_request_inter
     }
 
     ap_getparents(r->uri);     /* OK --- shrinking transformations... */
+    if (sconf->merge_slashes != AP_CORE_CONFIG_OFF) {
+        ap_no2slash(r->uri);
+        if (r->parsed_uri.path) {
+            ap_no2slash(r->parsed_uri.path);
+        }
+     }
 
     /* All file subrequests are a huge pain... they cannot bubble through the
      * next several steps.  Only file subrequests are allowed an empty uri,
@@ -1233,19 +1241,7 @@ AP_DECLARE(int) ap_location_walk(request
 
     cache = prep_walk_cache(AP_NOTE_LOCATION_WALK, r);
 
-    /* Location and LocationMatch differ on their behaviour w.r.t. multiple
-     * slashes.  Location matches multiple slashes with a single slash,
-     * LocationMatch doesn't.  An exception, for backwards brokenness is
-     * absoluteURIs... in which case neither match multiple slashes.
-     */
-    if (r->uri[0] != '/') {
-        entry_uri = r->uri;
-    }
-    else {
-        char *uri = apr_pstrdup(r->pool, r->uri);
-        ap_no2slash(uri);
-        entry_uri = uri;
-    }
+    entry_uri = r->uri;
 
     /* If we have an cache->cached location that matches r->uri,
      * and the vhost's list of locations hasn't changed, we can skip
@@ -1300,7 +1296,7 @@ AP_DECLARE(int) ap_location_walk(request
              * terminated (or at the end of the string) to match.
              */
             if (entry_core->r
-                ? ap_regexec(entry_core->r, r->uri, 0, NULL, 0)
+                ? ap_regexec(entry_core->r, entry_uri, 0, NULL, 0)
                 : (entry_core->d_is_fnmatch
                    ? apr_fnmatch(entry_core->d, cache->cached, APR_FNM_PATHNAME)
                    : (strncmp(entry_core->d, cache->cached, len)
