src/Control/Middleware/CanonicalURLMiddleware.php
protected function redirectToScheme(HTTPRequest $request, $scheme, $host = null)
    {
        if (!$host) {
            $host = $request->getHost();
        }

        $url = Controller::join_links("{$scheme}://{$host}", Director::baseURL(), $request->getURL(true));

        // Force redirect
        $response = HTTPResponse::create();
        $response->redirect($url, $this->getRedirectType());

        return $response;
    }
protected function redirectToScheme(HTTPRequest $request, $scheme, $host = null)
    {
        if (!$host) {
            $host = $request->getHost();
        }

        $url = Controller::join_links("{$scheme}://{$host}", Director::baseURL(), $request->getURL(true));

        // Force redirect
        $response = HTTPResponse::create();
        $response->redirect($url, $this->getRedirectType());

        return $response;
    }
protected function redirectToScheme ( HTTPRequest $ request , $ scheme , $ host = null ) { if ( ! $ host ) { $ host = $ request -> getHost ( ) ; } $ url = Controller :: join_links ( "{$scheme}://{$host}" , Director :: baseURL ( ) , $ request -> getURL ( true ) ) ; // Force redirect $ response = HTTPResponse :: create ( ) ; $ response -> redirect ( $ url , $ this -> getRedirectType ( ) ) ; return $ response ; }
Redirect the current URL to the specified HTTP scheme

@param HTTPRequest $request
@param string $scheme
@param string $host
@return HTTPResponse
Redirect the current URL to the specified HTTP scheme