code_junkie

Sending a 404 error in PHP

Nov 13th, 2011
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. if (strstr($_SERVER['REQUEST_URI'],'index.php')){
  2. header('HTTP/1.0 404 Not Found');
  3. echo "<h1>404 Not Found</h1>";
  4. echo "The page that you have requested could not be found.";
  5. exit();
  6. }
  7.  
  8. if (strstr($_SERVER['REQUEST_URI'],'index.php')){
  9. header('HTTP/1.0 404 Not Found');
  10. echo "<h1>404 Not Found</h1>";
  11. echo "The page that you have requested could not be found.";
  12. exit();
  13. }
  14.  
  15. if(strstr($_SERVER['REQUEST_URI'],'index.php')){
  16. header('HTTP/1.0 404 Not Found');
  17. readfile('404missing.html');
  18. exit();
  19. }
  20.  
  21. if (strstr($_SERVER['REQUEST_URI'],'index.php')){
  22. header('HTTP/1.0 404 Not Found');
  23. exit("<h1>404 Not Found</h1>nThe page that you have requested could not be found.");
  24. }
  25.  
  26. if($_SERVER['PHP_SELF'] == '/index.php'){
  27. header('HTTP/1.0 404 Not Found');
  28. echo "<h1>404 Not Found</h1>";
  29. echo "The page that you have requested could not be found.";
  30. die;
  31. }
Add Comment
Please, Sign In to add comment