diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php
index 73022a5f54..cd6cab7178 100644
--- a/core/lib/Drupal/Core/DrupalKernel.php
+++ b/core/lib/Drupal/Core/DrupalKernel.php
@@ -1068,7 +1068,7 @@ protected function initializeSettings(Request $request) {
     // upgrade to an optimized class loader.
     if ($class_loader_class == get_class($this->classLoader)
         && Settings::get('class_loader_auto_detect', TRUE)) {
-      $prefix = Settings::getApcuPrefix('class_loader', $this->root);
+      $prefix = Settings::getApcuPrefix('class_loader', $this->root, $site_path);
       $loader = NULL;
 
       // We autodetect one of the following three optimized classloaders, if
