Created
April 1, 2024 08:08
-
-
Save hctilg/635cf96991a4104948ee38230c29648e to your computer and use it in GitHub Desktop.
redirect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function redirect($url) { | |
if (!headers_sent()) { | |
header("Location: $url"); | |
} else { | |
echo "<script type='text/javascript'>window.location.href='$url'</script>"; | |
echo "<noscript><meta http-equiv='refresh' content='0;url=$url'/></noscript>"; | |
} | |
} | |
redirect("https://google.com/"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment