Returns the URL to redirect back to or / if not possible.

This method takes the referrer into account if the
request is not of type GET.

@return string
427336
protected function _getUrlToRedirectBackTo()
    {
        $urlToRedirectBackTo = $this->request->getRequestTarget();
        if (!$this->request->is('get')) {
            $urlToRedirectBackTo = $this->request->referer(true);
        }

        return $urlToRedirectBackTo;
    }
484665
public static function to()
    {
        // Is what we're providing a URL object?
        $args = func_get_args();
        if (is_object($args[0]) && $args[0] instanceof UrlInterface) {
            $url = $args[0];
        } else {
            $url = call_user_func_array('\URL::to', func_get_args());
        }
        $r = static::createRedirectResponse((string) $url, 302, array());

        return $r;
    }
1104562
public function previous()
    {
        $referrer = $this->request->headers->get('referer');

        $url = $referrer ? $this->to($referrer) : $this->getPreviousUrlFromSession();

        return $url ?: $this->to('/');
    }
1140274
public static function check_referer()
    {
        $uri     = parse_url($_SERVER['REQUEST_URI']);
        $referer = parse_url(self::request_header('Referer'));

        return $referer['host'] == self::request_header('Host') && $referer['path'] == $uri['path'];
    }
353898
protected function get()
    {
        $url = '';
        if ($this->scheme) {
            $url = $this->scheme . ':';
        }
        if ($this->host) {
            $url .= '//' . $this->authority();
        }
        if ($this->path) {
            $url .= '/' . ltrim($this->path, '/');
        }
        if ($this->query) {
            $url .= '?' . $this->query;
        }
        if ($this->fragment) {
            $url .= '#' . $this->fragment;
        }

        return $url;
    }
935094
public function getReferrer(): ?UrlInterface
    {
        $referrerHeader = $this->getHeader('Referer');
        if ($referrerHeader === null) {
            return null;
        }

        return Url::tryParse($referrerHeader);
    }
722045
public function getRedirectUri()
	{
		return null === $this->loginAgentUrl ? $this->callbackUrl : ($this->loginAgentUrl . '?' . http_build_query(array('redirect_uri'=>$this->callbackUrl)));
	}
464603
public function back()
    {
        $referer = $this->request->server()->get('HTTP_REFERER');

        if (null !== $referer) {
            $this->response->redirect($referer);
        } else {
            $this->refresh();
        }

        return $this;
    }
837270
public function getUrl()
    {
        if ($this->route !== null) {
            return route($this->route[0], $this->route[1]);
        }

        return url($this->url);
    }
345249
public function getRedirectUri()
    {
        $scopes = array_map(
            function(IScope $scope) {
                return $scope->getId();
            },
            $this->accessToken->getScopes()
        );

        $query = [
            'access_token' => $this->accessToken->getId(),
            'expires_in' => $this->accessToken->getExpiresAt() - time(),
            'token_type' => $this->tokenTypeName,
            'scope' => join(' ', $scopes)
        ];

        if ($this->state) {
            $query['state'] = $this->state;
        }

        ksort($query); // sort query params by key

        return $this->redirectUri . '#' . http_build_query($query);
    }
800524
public function getUrl()
    {
        if ($this->_url instanceof Closure) {
            return call_user_func($this->_url, $this);
        }

        return $this->_url ?: Yii::$app->request->referrer;
    }
303975
public function getReferrerUrl($fallBackToReferer = true)
    {
        if (!empty($this->refererUrl)) {
            return $this->refererUrl;
        }

        if ($fallBackToReferer) {
            return $this->header->get('REFERER', '');
        }

        return '';
    }
596905
public function getURL()
	{
		if (getenv("HTTP_REFERER")) {
			$url = getenv("REQUEST_URI");
		} elseif(getenv("REQUEST_URI") == "/") {
			$url = getenv("HTTP_HOST");
		} else {
			$url = getenv("HTTP_REFERER");
		}
		return $url;
	}
1126625
public function getPayURedirectUrl()
    {
        $mode = parent::$apiContext->get('mode');
        $reference = $this->return->payUReference;

        if (!$mode || !$reference)
            return null;

        $url = sprintf(self::REDIRECT_URL, $mode === 'sandbox' ? 'staging' : 'secure', $reference);

        return $url;
    }
412010
private function url()
    {
        if (isset($this->_options[self::ENTRY_BASEURL])) {
            return $this->_options[self::ENTRY_BASEURL];
        }

        // this is the fallback
        return Urls::URL_CURSOR;
    }
117661
private function getRedirectRouteFromRequest()
    {
        $request  = $this->application->getRequest();
        $redirect = $request->getQuery('redirect');
        if ($redirect && $this->routeExists($redirect)) {
            return $redirect;
        }

        $redirect = $request->getPost('redirect');
        if ($redirect && $this->routeExists($redirect)) {
            return $redirect;
        }

        return false;
    }
959651
public function getUrl()
  {
      $url = $this->baseAuthUrl;
      $url .= '?response_type=code';
      $url .= '&client_id='.$this->clientId;
      $url .= '&redirect_uri='.$this->redirectUri;
      $url .= '&scope='.implode(' ', $this->scopes);
      $url .= '&state='.$this->state;

      return $url;
  }