Skip to content

Commit

Permalink
Merge pull request #17 from experius/lewisvoncken-patch-2
Browse files Browse the repository at this point in the history
[BUGFIX] Solved invalid redirect url when the base url is different
  • Loading branch information
lewisvoncken authored Nov 18, 2020
2 parents b2d100f + 3a15012 commit 07bffbf
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Plugin/Magento/UrlRewrite/Model/StoreSwitcher/RewriteUrl.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ public function beforeSwitch(
$temp = explode('/',$redirectUrlTemp,5);
if (rtrim($temp[3],'/') == rtrim(end($temp),'/'))
{
if (strpos(rtrim($redirectUrl, '/'), rtrim($targetStore->getBaseUrl(),'/')) === false) {
$redirectUrl = $targetStore->getBaseUrl();
return [$fromStore,$targetStore,$redirectUrl];
}
return $return;
}
unset($temp);
Expand Down

0 comments on commit 07bffbf

Please sign in to comment.