function header_if($test, $status, $no_exit = false)
{
    if ($test) {
        switch ($status) {
            case 400:
                $header = "400 Bad Request";
                break;
            case 401:
                $header = "401 Unauthorized";
                break;
            case 403:
                $header = "403 Forbidden";
                break;
            case 404:
                $header = "404 Not Found";
                break;
            case 500:
                $header = "500 Server Error";
                break;
        }
        header("HTTP/1.1 " . $header);
        if (!isset($_SESSION["known_rejected_url"]) || $_SERVER["REQUEST_URI"] != $_SESSION["known_rejected_url"]) {
            urlrewrite();
            $_SESSION["known_rejected_url"] = $_SERVER["REQUEST_URI"];
            redirect_to_path($_SERVER["REQUEST_URI"]);
        } else {
            unset($_SESSION["known_rejected_url"]);
        }
        if (STATE == "development") {
            echo "\$_GET : ";
            var_dump($_GET);
            echo "\$_SESSION : ";
            var_dump($_SESSION);
            echo "\$_POST : ";
            var_dump($_POST);
            $backtrace = debug_backtrace();
            if (isset($backtrace[1])) {
                echo "Appelé par : ";
                var_dump($backtrace[1]["function"]);
            }
        } elseif (!is_empty($_SERVER["HTTP_REFERER"])) {
            mail_with_headers(WEBMASTER_EMAIL, get_bug_reference() . " Status " . $status . " : '" . $header . "'", "Requested URL : " . $_SERVER["REQUEST_URI"] . "<br>Previous URL : " . $_SERVER["HTTP_REFERER"]) . "<br>" . nl2br(get_debug_context());
        }
        $_GET["controller"] = "error";
        $_GET["action"] = $status;
        unset($_GET["prefix"]);
        include LAYOUT_PATH . "application.php";
        if (!$no_exit) {
            exit;
        }
    }
}
<?php

include "global/initialisation.php";
urlrewrite();