From f303b9521b6ea3195ccdedfbdb9edd39fcd649f7 Mon Sep 17 00:00:00 2001 From: Jason Woofenden Date: Thu, 21 Dec 2006 20:14:56 -0500 Subject: [PATCH] with run.php you can make your own 404.html and/or 404.php --- run.php | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/run.php b/run.php index c8eeb10..716e364 100644 --- a/run.php +++ b/run.php @@ -51,11 +51,16 @@ # RewriteBase /foo/ # RewriteRule .*\.html$ /foo/code/wfpl/run.php -function run_php() { - chdir('../..'); - $html_file = $_SERVER['REDIRECT_URL']; - $html_file = ereg_replace('.*/', '', $html_file); - $php_file = ereg_replace('\.html$', '.php', $html_file); +function run_php($basename = false) { + if($basename) { + $html_file = "$basename.html"; + $php_file = "$basename.php"; + } else { + chdir('../..'); + $html_file = $_SERVER['REDIRECT_URL']; + $html_file = ereg_replace('.*/', '', $html_file); + $php_file = ereg_replace('\.html$', '.php', $html_file); + } if($php_file != $html_file && file_exists($php_file)) { require_once('code/wfpl/template.php'); if(file_exists($html_file)) tem_load($html_file); @@ -66,7 +71,11 @@ function run_php() { require $html_file; } else { header('HTTP/1.0 404 File Not Found'); - echo '404

404 File Not Found

'; + if(file_exists('404.php') || file_exists('404.html')) { + run_php('404'); + } else { + echo '404

404 File Not Found

'; + } } } } -- 1.7.10.4