Posted By

frederichoule on 04/01/11


Tagged

php header redirect


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

frederichoule
kwanhon


PHP Redirect


 / Published in: PHP
 

  1. function redirect($url,$die=true,$permanent=false) {
  2. if(headers_sent()) {
  3. print("<script type=\"text/javascript\">window.location.href='{$url}';</script>");
  4. } else {
  5. if($permanent) {
  6. header("HTTP/1.1 301 Moved Permanently");
  7. }
  8. header("Location: {$url}");
  9. }
  10. if($die) { die(); }
  11. }

Report this snippet  

You need to login to post a comment.