Skip to content

Instantly share code, notes, and snippets.

@jworksuk
Last active December 23, 2015 11:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jworksuk/6625506 to your computer and use it in GitHub Desktop.
Save jworksuk/6625506 to your computer and use it in GitHub Desktop.
simple redirect
<?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