From 776ceb2ef6e937255b79da61af58224b78da5cbe Mon Sep 17 00:00:00 2001 From: Mathieu Rochette Date: Fri, 26 Oct 2012 14:06:41 +0200 Subject: [PATCH] Answer with a 404 status code when the page is not found --- lib/pico.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/pico.php b/lib/pico.php index 17ce990..29d10ba 100644 --- a/lib/pico.php +++ b/lib/pico.php @@ -21,7 +21,10 @@ class Pico { else $file .= '.txt'; if(file_exists($file)) $content = file_get_contents($file); - else $content = file_get_contents(CONTENT_DIR .'404.txt'); + else { + $content = file_get_contents(CONTENT_DIR .'404.txt'); + header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found'); + } $meta = $this->read_file_meta($content); $content = preg_replace('#/\*.+?\*/#s', '', $content); // Remove comments and meta