public static function redirect($url, $permanent = false, $timer = 0, $die = true, $noForceJsRedirect = false) {
        if (headers_sent()) {
            if ($noForceJsRedirect) {
                echo '<script language="javascript" type="text/javascript">window.setTimeout("location=(\'' . $url . '\');", ' . $timer . '*1000);</script>';
                // if javascript deactived, redirect with meta
                echo '<noscript><meta http-equiv="refresh" content="' . $timer . ';url=' . $url . '" /></noscript>';
            }
        } else {
            if ($timer != 0)
                header('refresh: ' . $timer . ';location=' . $url);
            else
                header('location:' . $url);

            if ($permanent)
                header('Status: 301 Moved Permanently', false, 301);
        }
        if ($die)
            exit();
    }