diff --git a/public_html/modules/landing.php b/public_html/modules/landing.php
index d4eaf30..4dbe66f 100644
--- a/public_html/modules/landing.php
+++ b/public_html/modules/landing.php
@@ -19,6 +19,7 @@ try
}
catch (NotFoundException $e)
{
+ http_status_code(404);
$sPageContents = NewTemplater::Render("404", $locale->strings, array());
return;
}
diff --git a/public_html/rewrite.php b/public_html/rewrite.php
index c47fea9..40b8b81 100644
--- a/public_html/rewrite.php
+++ b/public_html/rewrite.php
@@ -81,7 +81,16 @@ $router->routes = array(
)
);
-$router->RouteRequest();
+try
+{
+ $router->RouteRequest();
+}
+catch (RouterException $e)
+{
+ http_status_code(404);
+ $sPageTitle = "Page not found";
+ $sPageContents = NewTemplater::Render("404", $locale->strings, array());
+}
echo(NewTemplater::Render("layout", $locale->strings, array("contents" => $sPageContents, "title" => $sPageTitle,
"padded" => (isset($router->uVariables['padded']) ? $router->uVariables['padded'] : true))));