diff --git a/system/src/Grav/Common/Grav.php b/system/src/Grav/Common/Grav.php index f72d799ae..38ff62fa1 100644 --- a/system/src/Grav/Common/Grav.php +++ b/system/src/Grav/Common/Grav.php @@ -255,7 +255,13 @@ class Grav extends Container $this['session']->close(); } - header("Location: " . rtrim($uri->rootUrl(), '/') .'/'. trim($route, '/'), true, $code); + if ($this['uri']->isExternal($route)) { + $url = $route; + } else { + $url = rtrim($uri->rootUrl(), '/') .'/'. trim($route, '/'); + } + + header("Location: {$url}", true, $code); exit(); } diff --git a/system/src/Grav/Common/Uri.php b/system/src/Grav/Common/Uri.php index 839b91c11..d1dad9fda 100644 --- a/system/src/Grav/Common/Uri.php +++ b/system/src/Grav/Common/Uri.php @@ -378,6 +378,20 @@ class Uri return $ipaddress; } + /** + * Is this an external URL? if it starts with `http` then yes, else false + * + * @param string $url the URL in question + * @return boolean is eternal state + */ + public function isExternal($url) + { + if (Utils::startsWith($url, 'http')) { + return true; + } else { + return false; + } + } /** * The opposite of built-in PHP method parse_url()