diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc
index 1353daa77ed20d4700dad6980c0ae85b8bad1a77..14b0e79078d60ae54d4c00996643d4de6ecd946e 100644
--- a/includes/bootstrap.inc
+++ b/includes/bootstrap.inc
@@ -156,7 +156,10 @@ function conf_init() {
   if (isset($base_url)) {
     // Parse fixed base URL from settings.php.
     $parts = parse_url($base_url);
-    $base_path = isset($parts['path']) ? $parts['path'] . '/' : '/';
+    if (!isset($parts['path'])) {
+      $parts['path'] = '';
+    }
+    $base_path = $parts['path'] . '/';
     // Build $base_root (everything until first slash after "scheme://").
     $base_root = substr($base_url, 0, strlen($base_url) - strlen($parts['path']));
   }