random1 Posted November 23, 2007 Share Posted November 23, 2007 How do you redirect to another page if a .php file fails (not found) on require("pagename.php") or include()? Currently it just shows blank white window. Quote Link to comment Share on other sites More sharing options...
~n[EO]n~ Posted November 23, 2007 Share Posted November 23, 2007 <?php $filename = 'pagename.php'; if (file_exists($filename)) { require_once('pagename.php');; } else { header ("Location: index.php"); /* Redirect browser */ /* Make sure that code below does not get executed when we redirect. */ exit; } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.