framework/web/Request.php
public function getUrl()
    {
        if ($this->_url === null) {
            $this->_url = $this->resolveRequestUri();
        }

        return $this->_url;
    }
public function getUrl()
    {
        if ($this->_url === null) {
            $this->_url = $this->resolveRequestUri();
        }

        return $this->_url;
    }
Returns the currently requested relative URL.
This refers to the portion of the URL that is after the [[hostInfo]] part.
It includes the [[queryString]] part if any.
@return string the currently requested relative URL. Note that the URI returned may be URL-encoded depending on the client.
@throws InvalidConfigException if the URL cannot be determined due to unusual server configuration