if(empty($query)) {
    header("Location: ".$_SERVER['HTTP_HOST']);
}