From d34907aeac60fe9784e8fda7150904a780c04b8b Mon Sep 17 00:00:00 2001 From: "vivien.dufour" Date: Fri, 27 Oct 2023 08:46:19 +0200 Subject: [PATCH] moving to public_html for exec --- index.php | 5 +++-- src/View/error.php | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 src/View/error.php diff --git a/index.php b/index.php index 0fbd9f7..38e9adc 100644 --- a/index.php +++ b/index.php @@ -13,8 +13,9 @@ $router->map("GET", "/", fn() => $helloController->display()); $match = $router->match(); -if ($match == null) { - // TODO redirect to a 404 not found page instead (issue #1) +if (!$match) { + $error = "error404"; + require_once 'src/View/error.php'; header('HTTP/1.1 404 Not Found'); exit(1); } diff --git a/src/View/error.php b/src/View/error.php new file mode 100644 index 0000000..f01a7ce --- /dev/null +++ b/src/View/error.php @@ -0,0 +1,18 @@ + + + Error + + + + +Error 404"; + echo "

Page not found

"; + } +} +?> + + + \ No newline at end of file