Posted By

onefastsnail on 05/24/12


Tagged


Versions (?)

301 redirect


 / Published in: Other
 

  1. <?
  2.  
  3. $path = './';
  4. include($path.'includes/header.inc.php');
  5.  
  6. $url = (@$_SERVER["HTTPS"] == "on") ? "https://" : "http://";
  7. if ($_SERVER["SERVER_PORT"] != "80"){
  8. $url .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
  9. }
  10. else
  11. {
  12. $url .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
  13. }
  14.  
  15. $db = new sql;
  16. $db->query("select * from items where old_url='".$url."'");
  17.  
  18. if($db->num_rows()==1){
  19. $row = $db->fetch_array();
  20.  
  21. $item = new item;
  22. $item->Get_Item($row["id"]);
  23. $gogogo = $item->url;
  24. }
  25. else {
  26. $gogogo = SITE_URL;
  27. }
  28.  
  29. header("Location: ".$gogogo); exit;
  30.  
  31. ?>

Report this snippet  

You need to login to post a comment.