Last active
April 6, 2016 11:16
-
-
Save nasirkhan/6711689 to your computer and use it in GitHub Desktop.
php and javascript page reditect
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
$url = "index.php"; | |
redirect($url); | |
function redirect($url) { | |
if (headers_sent()) { | |
die('<script type="text/javascript">window.location.href="' . $url . '";</script>'); | |
} else { | |
header('Location: ' . $url); | |
die(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment