Solved, this is my temporary solution for the 404 error page.
if (sizeof($url) != 1) {
header('Location: ../404');
}
else {
// nothing
}
default:
$page_name = 'Error';
$page_file = 'pages/errors/404.php';
break;
Solved, this is my temporary solution for the 404 error page.
if (sizeof($url) != 1) {
header('Location: ../404');
}
else {
// nothing
}
default:
$page_name = 'Error';
$page_file = 'pages/errors/404.php';
break;
Change the code in your default:
section to return HTTP 404 code and generate a proper template. See this question as reference.
PS. You seem to check only the first part of the URL, i.e. $_GET[0]
, but looks like you don't process any subsequent ($_GET[1],...
) parts of it. In general I would advise you to either build your app on any mainstream framework with proper routing package in it or if you don't feel like using any fullstack PHP framework, you can install just any routing package via composer
. E.g. symfony/routing