public 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.

@api

Return value

string The raw url (i.e. not urldecoded)

4 calls to Request::getBaseUrl()
Request::getUri in drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Request.php
Generates a normalized URI for the Request.
Request::getUriForPath in drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Request.php
Generates a normalized URI for the given path.
Request::prepareBasePath in drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Request.php
Prepares the base path.
Request::preparePathInfo in drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Request.php
Prepares the path info.

File

drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Request.php, line 684

Class

Request
Request represents an HTTP request.

Namespace

Symfony\Component\HttpFoundation

Code

public function getBaseUrl() {
  if (null === $this->baseUrl) {
    $this->baseUrl = $this
      ->prepareBaseUrl();
  }
  return $this->baseUrl;
}