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. Link to comment https://forums.phpfreaks.com/topic/78519-solved-require-and-include-redirect/ 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; } ?> Link to comment https://forums.phpfreaks.com/topic/78519-solved-require-and-include-redirect/#findComment-397344 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.