The following uses the PHP header function for redirection:

function redirect($url)
{
    header("Location: $url");
    exit();
}