framework/web/Request.php
public function getBaseUrl()
    {
        if ($this->_baseUrl === null) {
            $this->_baseUrl = rtrim(dirname($this->getScriptUrl()), '\\/');
        }

        return $this->_baseUrl;
    }
public function getBaseUrl()
    {
        if ($this->_baseUrl === null) {
            $this->_baseUrl = rtrim(dirname($this->getScriptUrl()), '\\/');
        }

        return $this->_baseUrl;
    }
Returns the relative URL for the application.
This is similar to [[scriptUrl]] except that it does not include the script file name,
and the ending slashes are removed.
@return string the relative URL for the application
@see setScriptUrl()