final public static function redirectToRoute(
        string $routename,
        array $params = array(),
        bool $domain = true,
        array $query = array(),
        int $status = 302
    ):void {

        $querystring = $domainstring = "";
        $route = self::generateRoute($routename, $params);
        if (!empty($query)) {
            foreach ($query as $one => $value) {
                $querystring .= "$one=$value".(((end($query) !== $value))? "&": "");
            }
            $querystring = "?$querystring";
        }

        if (true === $domain) {
            $server = new GlobalServer();
            $https = ((null !== $server->get("HTTPS") &&
                "on" === $server->get("HTTPS"))? "https://" : "http://");
            $domain = $https.$server->get("HTTP_HOST");
        }
        header("Location: $domain$route$querystring", $status);
        exit(1);
    }
final public static function redirectToRoute(
        string $routename,
        array $params = array(),
        bool $domain = true,
        array $query = array(),
        int $status = 302
    ):void {

        $querystring = $domainstring = "";
        $route = self::generateRoute($routename, $params);
        if (!empty($query)) {
            foreach ($query as $one => $value) {
                $querystring .= "$one=$value".(((end($query) !== $value))? "&": "");
            }
            $querystring = "?$querystring";
        }

        if (true === $domain) {
            $server = new GlobalServer();
            $https = ((null !== $server->get("HTTPS") &&
                "on" === $server->get("HTTPS"))? "https://" : "http://");
            $domain = $https.$server->get("HTTP_HOST");
        }
        header("Location: $domain$route$querystring", $status);
        exit(1);
    }
final public static function redirectToRoute ( string $ routename , array $ params = array ( ) , bool $ domain = true , array $ query = array ( ) , int $ status = 302 ) : void { $ querystring = $ domainstring = "" ; $ route = self :: generateRoute ( $ routename , $ params ) ; if ( ! empty ( $ query ) ) { foreach ( $ query as $ one => $ value ) { $ querystring .= "$one=$value" . ( ( ( end ( $ query ) !== $ value ) ) ? "&" : "" ) ; } $ querystring = "?$querystring" ; } if ( true === $ domain ) { $ server = new GlobalServer ( ) ; $ https = ( ( null !== $ server -> get ( "HTTPS" ) && "on" === $ server -> get ( "HTTPS" ) ) ? "https://" : "http://" ) ; $ domain = $ https . $ server -> get ( "HTTP_HOST" ) ; } header ( "Location: $domain$route$querystring" , $ status ) ; exit ( 1 ) ; }
Redirect to an app route
@param string $routename route name
@param array $params Parameter if route have any parameters
@param bool $domain If domain is included on url
@param array $query Query string
@throws Server500
@throws \Exception
Redirect to an app route