header("Location: pagename.php");
add a script in the very top of your page to check for example if the user is logged In :
//////////////////////////////////////////
<script>
if (window.sessionStorage.getItem("data") == null) {
window.location.replace(
"http://localhost/hospital/front-end/public/index.html"
);
}
</script>
///////////////////////////////////////////