feat: ✨ properly utilise 404 page again
This commit is contained in:
parent
d47c4e2072
commit
f2f8a235c8
1 changed files with 13 additions and 3 deletions
|
@ -34,9 +34,7 @@ $twig->addRuntimeLoader(new class implements RuntimeLoaderInterface {
|
|||
|
||||
$SURI = $_SERVER['REQUEST_URI'];
|
||||
|
||||
if($SURI == '/') {
|
||||
echo $twig->render('root.html');
|
||||
} elseif(preg_match('/^\/api\/admin/', $SURI)) {
|
||||
if(preg_match('/^\/api\/admin/', $SURI)) {
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$user_api_key = '';
|
||||
|
@ -82,6 +80,18 @@ if($SURI == '/') {
|
|||
} elseif(true) {
|
||||
$post = $adapter->get_post_by_path($SURI);
|
||||
|
||||
if(!$post['found']) {
|
||||
echo $twig->render('post_types/rrror.html',[
|
||||
"error_code" => '404 Hoard not found!',
|
||||
"error_description" => "Well, we searched
|
||||
far and wide for `" . $SURI . "` but
|
||||
somehow it must have gotten lost... Sorry!",
|
||||
"post" => $post
|
||||
]);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if($post['post_metadata']['type'] == 'directory') {
|
||||
if(preg_match('/^(.*[^\/])((?:#.*)?)$/', $SURI, $match)) {
|
||||
header('Location: ' . $match[1] . '/' . $match[2]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue