From 1e654302080d50a8a0fe993ece950b33a2f75ac6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rn=20=C3=85ne?= Date: Sun, 5 Apr 2020 14:24:32 +0200 Subject: [PATCH] More kosher 404 error PHP can set the HTTP code using the 3rd argument of header() --- index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.php b/index.php index 2bc6ba7..fbcabe0 100644 --- a/index.php +++ b/index.php @@ -26,6 +26,6 @@ if( $match && is_callable( $match['target'] ) ) { call_user_func_array( $match['target'], $match['params'] ); } else { - header( $_SERVER["SERVER_PROTOCOL"] . ' 404 Not Found'); - echo "Error 404: Not found"; + header( 'Content-Type: text/plain', true, 404 ); + echo "404 Not Found\r\n"; }