function Request::getBaseUrl
Returns the root URL from which this request is executed.
The base URL never ends with a /.
This is similar to getBasePath(), except that it also includes the script filename (e.g. index.php) if one exists.
Return value
string The raw URL (i.e. not urldecoded)
3 calls to Request::getBaseUrl()
- Request::getUri in vendor/
symfony/ http-foundation/ Request.php - Generates a normalized URI (URL) for the Request.
- Request::getUriForPath in vendor/
symfony/ http-foundation/ Request.php - Generates a normalized URI for the given path.
- Request::prepareBasePath in vendor/
symfony/ http-foundation/ Request.php - Prepares the base path.
File
-
vendor/
symfony/ http-foundation/ Request.php, line 828
Class
- Request
- Request represents an HTTP request.
Namespace
Symfony\Component\HttpFoundationCode
public function getBaseUrl() : string {
$trustedPrefix = '';
// the proxy prefix must be prepended to any prefix being needed at the webserver level
if ($this->isFromTrustedProxy() && ($trustedPrefixValues = $this->getTrustedValues(self::HEADER_X_FORWARDED_PREFIX))) {
$trustedPrefix = rtrim($trustedPrefixValues[0], '/');
}
return $trustedPrefix . $this->getBaseUrlReal();
}