public static function to($path, $code = 302, $trigger = true)
    {
        $debuglvl = self::$debuglvl;
        self::$debuglvl = 2;

        if (headers_sent()) {
            throw new Exception('Headers already sent', $debuglvl);
        } elseif ($code < 300 || $code > 399) {
            throw new Exception('Invalid redirect HTTP status', $debuglvl);
        } elseif (empty($path)) {
            throw new Exception('Path is not defined', $debuglvl);
        } elseif (strpos($path, '/') === 0) {
            $path = Uri::root($path);
        }

        Response::status($code, $trigger);
        Response::putHeader('Location', $path);
    }