Reputation: 101
I want to show the 404 page when user enters unknown address like on the above image.
I can control the unknown address after index.php
but don't know how to do this for the part before the index.php
part.
I wrote this code to control what user enters after index.php
<?php
$pageName = 'places';
if (isset($_GET['page'])) {
$pageName = $_GET['page'];
}
$pageList = array(
'places',
'places_info',
'save'
);
if (!in_array($pageName, $pageList)) {
$pageName = '404';
}
?>
Upvotes: 1
Views: 386
Reputation: 4193
It looks like you have apache on your development machine.
The way to have custom error pages is
If you type in localhost/blit/xxy and xxy.php and xxy.html do not exist then the error page will be shown.
Upvotes: 1