implement new 404 test handler

not efficent but if you're webserver can't pull from redis, this will work for a demo
This commit is contained in:
root 2015-12-22 01:51:25 -05:00
parent 844b262166
commit b9e443a1e2

21
404.php Normal file
View File

@ -0,0 +1,21 @@
<?php
require_once 'inc/functions.php';
$base=substr(dirname(str_replace($_SERVER['DOCUMENT_ROOT'], '', $_SERVER['SCRIPT_FILENAME'])), 1);
//echo "base[$base]<br>\n";
$path=trim($_SERVER['REQUEST_URI'], '/');
$path=str_replace($base.'/', '', $path);
if (file_exists($path) && !is_dir($path)) {
if (strpos($path, 'css')!==false) {
header('Content-type: text/css');
}
readfile($path);
exit();
}
if (is_dir($path)) {
$path.='/index.html';
}
$key='vichan_filecache_'.$path;
echo Cache::get($key);
?>