You are here

protected function ApacheRequest::prepareBaseUrl in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-foundation/ApacheRequest.php \Symfony\Component\HttpFoundation\ApacheRequest::prepareBaseUrl()

Prepares the base URL.

Return value

string

Overrides Request::prepareBaseUrl

File

vendor/symfony/http-foundation/ApacheRequest.php, line 32

Class

ApacheRequest
Request represents an HTTP request from an Apache server.

Namespace

Symfony\Component\HttpFoundation

Code

protected function prepareBaseUrl() {
  $baseUrl = $this->server
    ->get('SCRIPT_NAME');
  if (false === strpos($this->server
    ->get('REQUEST_URI'), $baseUrl)) {

    // assume mod_rewrite
    return rtrim(dirname($baseUrl), '/\\');
  }
  return $baseUrl;
}