PHP- Kodu:
<?php
function yonlendir($url){
    if(!
headers_sent())    {
        
header("Location: {$url}");
    } else {
        die(
"<script type='text/javascript'>location.href = '{$url}';</script>");
    }
}
?>