Last active
December 23, 2015 11:01
-
-
Save jworksuk/6625506 to your computer and use it in GitHub Desktop.
simple 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 to redirect browser to a specific page | |
*/ | |
function redirect($url) | |
{ | |
if ( ! headers_sent() ) | |
{ | |
header('Location: '.$url); | |
} | |
else | |
{ | |
echo '<script type="text/javascript">'; | |
echo 'window.location.href="'.$url.'";'; | |
echo '</script>'; | |
echo '<noscript>'; | |
echo '<meta http-equiv="refresh" content="0;url='.$url.'" />'; | |
echo '</noscript>'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment