Get the full form (e.g. /home/) relative link to the home page for the current HTTP_HOST value. Note that the
link is trimmed of leading and trailing slashes before returning to ensure consistency.

@return string
764129
public static function get_homepage_link()
    {
        if (!self::$cached_homepage_link) {
            $link = Config::inst()->get(__CLASS__, 'default_homepage_link');
            singleton(__CLASS__)->extend('updateHomepageLink', $link);
            self::$cached_homepage_link = $link;
        }
        return self::$cached_homepage_link;
    }
1215270
public function getHost() {
		if (!is_null($this->host)) {
			return $this->host;
		}

		if ($_SERVER['HTTP_X_FORWARDED_HOST']) {
			$elements = explode(',', $value);
			$host = trim(end($elements));
		} else if ($_SERVER['HTTP_HOST']) {
			$host = $_SERVER['HTTP_HOST'];
		} else if ($_SERVER['SERVER_NAME']) {
			$host = $_SERVER['SERVER_NAME'];
		}

		if (isset($host)) {
			$host = preg_replace('/:\d+$/', '', $host);
			$this->host = $host;
		}

		return $this->host;
	}
751107
public function url()
    {
        $dirname = $this->parent->url();

        if ($this->parent instanceof Root) { //at root

            return $dirname.$this->basename();
        }

        return sprintf('%s/%s', $dirname, $this->basename());

    }
88681
public static function GetCallingURL()
    {
        $sURL = '/';
        if (array_key_exists(self::SESSION_PARAM_NAME, $_SESSION)) {
            $sURL = $_SESSION[self::SESSION_PARAM_NAME];
        } else {
            $sURL = self::getPageService()->getLinkToPortalHomePageAbsolute();
        }

        return $sURL;
    }
827726
public static function getCurrentURL()
    {
        $pageURL = 'http';
        if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on")
        {
            $pageURL .= "s";
        }
        $pageURL .= "://";
        if ($_SERVER["SERVER_PORT"] != "80")
        {
            $pageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
        }
        else
        {
            $pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
        }
        return $pageURL;
    }
800252
protected function _getHostFromUri()
    {
        $host  = $this->uri->getHost();
        $host .= $this->uri->getPort() ? ':' . $this->uri->getPort() : '';
        return $host;
    }
1292479
public static function fullUrl()
    {
        $s        = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : "";
        $protocol = StringUtils::strLeft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/").$s;
        $port     = ($_SERVER["SERVER_PORT"] == "80" || $_SERVER["SERVER_PORT"] == "443") ? "" : (":".$_SERVER["SERVER_PORT"]);
        $uri      = (isset($_SERVER['REQUEST_URI'])?$_SERVER['REQUEST_URI']:"");
        return $protocol."://".$_SERVER['SERVER_NAME'].$port.$uri;
    }
1198839
public static function getHost()
    {
        $host = '';
        if (isset($_SERVER['HTTP_X_FORWARDED_HOST']) && $host = $_SERVER['HTTP_X_FORWARDED_HOST']) {
            $elements = explode(',', $host);
            $host     = trim(end($elements));
        } else {
            if (isset($_SERVER['HTTP_HOST']) && !$host = $_SERVER['HTTP_HOST']) {
                if (isset($_SERVER['SERVER_NAME']) && !$host = $_SERVER['SERVER_NAME']) {
                    $host = !empty($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : '';
                }
            }
        }
        // Remove port number from host
        $host = preg_replace('/:\d+$/', '', $host);

        return trim($host);
    }
98613
protected function getPageUrl()
    {
        // Fetch chash
        $pageHash = null;
        if (!empty($GLOBALS['TSFE']->cHash)) {
            $pageHash = $GLOBALS['TSFE']->cHash;
        }


        // Fetch pageUrl
        if ($pageHash !== null) {
            $ret = FrontendUtility::getCurrentUrl();
        } else {
            $linkConf = array(
                'parameter' => $GLOBALS['TSFE']->id,
            );

            $ret = $GLOBALS['TSFE']->cObj->typoLink_URL($linkConf);
            $ret = $this->processLinkUrl($ret);
        }

        return $ret;
    }
665383
public function getFlexiBeeURL()
    {
        $parsed_url = parse_url(str_replace('.'.$this->format, '', $this->apiURL));
        $scheme     = isset($parsed_url['scheme']) ? $parsed_url['scheme'].'://'
                : '';
        $host       = isset($parsed_url['host']) ? $parsed_url['host'] : '';
        $port       = isset($parsed_url['port']) ? ':'.$parsed_url['port'] : '';
        $user       = isset($parsed_url['user']) ? $parsed_url['user'] : '';
        $pass       = isset($parsed_url['pass']) ? ':'.$parsed_url['pass'] : '';
        $pass       = ($user || $pass) ? "$pass@" : '';
        $path       = isset($parsed_url['path']) ? $parsed_url['path'] : '';
        return $scheme.$user.$pass.$host.$port.$path;
    }
938667
public function getUrlBase() : string
    {
        $url = sprintf('%s://%s', $this->getScheme(), $this->host);
        $isStandardPort = ($this->port === ($this->isSecure ? 443 : 80));

        return $isStandardPort ? $url : $url . ':' . $this->port;
    }
779165
public function urlExtension()
    {
        if ($this->home()) {
            return '';
        }

        // if not set in the page get the value from system config
        if (null === $this->url_extension) {
            $this->url_extension = Grav::instance()['config']->get('system.pages.append_url_extension', '');
        }

        return $this->url_extension;
    }
1283908
public function getSiteUrl(): string
    {
        $url = $this->getStringValue(PlatformConfigurationInterface::KEY_SITE_URL);

        if (empty($url)) {
            $scheme = \filter_input(INPUT_SERVER, 'REQUEST_SCHEME');
            $server = \filter_input(INPUT_SERVER, 'SERVER_NAME');
            $url = $scheme.'://'.$server;
        }

        return $url;
    }
22364
protected static function getBaseUrl()
  {
    $baseUrl = 'https://';
    if (!self::$ssl) {
      $baseUrl = 'http://';
    }
    $baseUrl .= sprintf('%s:%s/%s/', self::$host, self::$port, self::$context);
    return $baseUrl;
  }
596905
public function getURL()
	{
		if (getenv("HTTP_REFERER")) {
			$url = getenv("REQUEST_URI");
		} elseif(getenv("REQUEST_URI") == "/") {
			$url = getenv("HTTP_HOST");
		} else {
			$url = getenv("HTTP_REFERER");
		}
		return $url;
	}
830719
public static function getCurrentURL()
    {
        $url = 'http://';
        if (self::isHttps()) {
            $url = 'https://';
        }

        if (isset($_SERVER['PHP_AUTH_USER'])) {
            $url .= $_SERVER['PHP_AUTH_USER'];
            if (isset($_SERVER['PHP_AUTH_PW'])) {
                $url .= ':'.$_SERVER['PHP_AUTH_PW'];
            }
            $url .= '@';
        }
        if (isset($_SERVER['HTTP_HOST'])) {
            $url .= $_SERVER['HTTP_HOST'];
        }
        if (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] != 80) {
            $url .= ':'.$_SERVER['SERVER_PORT'];
        }
        if (!isset($_SERVER['REQUEST_URI'])) {
            $url .= substr($_SERVER['PHP_SELF'], 1);
            if (isset($_SERVER['QUERY_STRING'])) {
                $url .= '?'.$_SERVER['QUERY_STRING'];
            }

            return $url;
        }

        $url .= $_SERVER['REQUEST_URI'];

        return $url;
    }
136866
protected function buildUrl()
    {
        $url = '';

        if (isset($this->info['scheme'])) {
            $url .= $this->info['scheme'].'://';
        }
        if (isset($this->info['host'])) {
            $url .= $this->info['host'];
        }

        $url .= $this->getPath();

        if (!empty($this->info['query'])) {
            $url .= '?'.http_build_query($this->info['query']);
        }
        if (isset($this->info['fragment'])) {
            $url .= '#'.$this->info['fragment'];
        }

        return $url;
    }