diff --git a/core/modules/path_alias/src/Entity/PathAlias.php b/core/modules/path_alias/src/Entity/PathAlias.php
index aabbaaff1e..418370a4fe 100644
--- a/core/modules/path_alias/src/Entity/PathAlias.php
+++ b/core/modules/path_alias/src/Entity/PathAlias.php
@@ -95,8 +95,9 @@ public function preSave(EntityStorageInterface $storage) {
     parent::preSave($storage);
 
     // Trim the alias value of whitespace and slashes. Ensure to not trim the
-    // slash on the left side.
-    $alias = rtrim(trim($this->getAlias()), "\\/");
+    // Slash on the left side and not remove single slash alias (homepage).
+    $trimmedAlias = trim($this->getAlias());
+    $alias = $trimmedAlias !== '/' ? rtrim($trimmedAlias, "\\/") : $trimmedAlias;
     $this->setAlias($alias);
   }
 
