Given a URL:
http://mysite.com/this-is/the/path
I just want the scheme and the host I.e. http://mysite.com/
Currently I am using parse_url
and then building it back up like so:
$urlParts = parse_url($url);
$newUrl = $urlParts['scheme'] . "://" . $urlParts['host'] . "/";
Is there no PHP function that can strip the path off?