From 4e1ed523b48dd3ac74c80aeba8510f1aeb7a4a2c Mon Sep 17 00:00:00 2001 From: Sathakathulla-S Date: Thu, 17 Apr 2025 19:33:04 +0530 Subject: [PATCH] URL switch problem in a store with a redirection issue fixed --- .../Magento/UrlRewrite/Model/StoreSwitcher/RewriteUrl.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/UrlRewrite/Model/StoreSwitcher/RewriteUrl.php b/app/code/Magento/UrlRewrite/Model/StoreSwitcher/RewriteUrl.php index 873eed4466715..6728dd69d4bcc 100644 --- a/app/code/Magento/UrlRewrite/Model/StoreSwitcher/RewriteUrl.php +++ b/app/code/Magento/UrlRewrite/Model/StoreSwitcher/RewriteUrl.php @@ -77,7 +77,12 @@ public function switch(StoreInterface $fromStore, StoreInterface $targetStore, s $targetUrl .= $currentRewrite->getRequestPath(); } } else { - $existingRewrite = $this->urlFinder->findOneByData([UrlRewrite::REQUEST_PATH => $urlPath]); + $existingRewrite = $this->urlFinder->findOneByData( + [ + UrlRewrite::REQUEST_PATH => $urlPath, + UrlRewrite::STORE_ID => $oldStoreId, + ] + ); $currentRewrite = $this->urlFinder->findOneByData( [ UrlRewrite::REQUEST_PATH => $urlPath,