diff --git a/src/Facades/Endpoint/URL.php b/src/Facades/Endpoint/URL.php index 90b8dbfc754..f13e51fc84b 100644 --- a/src/Facades/Endpoint/URL.php +++ b/src/Facades/Endpoint/URL.php @@ -161,7 +161,10 @@ public function prependSiteUrl(?string $url, ?string $locale = null, bool $contr */ public function removeSiteUrl(?string $url): string { - return self::tidy(preg_replace('#^'.Config::getSiteUrl().'#', '/', $url)); + $url = URL::makeAbsolute($url); + $url = Str::removeLeft($url, Site::current()->absoluteUrl()); + + return self::tidy($url); } /**