+added page 404
This commit is contained in:
parent
7484bea239
commit
ed374a882c
|
@ -41,10 +41,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function bundle(){
|
public function bundle(){
|
||||||
if( is_null($this->page) ){
|
if( is_null($this->page) )
|
||||||
http_response_code(404);
|
include __PUBLIC__.'/page/404.php';
|
||||||
die();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (1) Extract /public_html/js/ all .js files */
|
/* (1) Extract /public_html/js/ all .js files */
|
||||||
$js_scripts = glob(__PUBLIC__.'/js/bundle/'.$this->page.'@*.js');
|
$js_scripts = glob(__PUBLIC__.'/js/bundle/'.$this->page.'@*.js');
|
||||||
|
@ -61,8 +59,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (3) If nothing found */
|
/* (3) If nothing found */
|
||||||
http_response_code(404);
|
include __PUBLIC__.'/page/404.php';
|
||||||
die();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,10 +28,8 @@
|
||||||
$page_fname = __PUBLIC__."/page/".$this->pagename.".php";
|
$page_fname = __PUBLIC__."/page/".$this->pagename.".php";
|
||||||
|
|
||||||
/* (2) If page does not exist -> 404 */
|
/* (2) If page does not exist -> 404 */
|
||||||
if( !file_exists($page_fname) ){
|
if( !file_exists($page_fname) )
|
||||||
http_response_code(404);
|
include __PUBLIC__.'/page/404.php';
|
||||||
die('Page not found');
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (3) Set URI arguments */
|
/* (3) Set URI arguments */
|
||||||
$_GET['uri'] = explode('/', $this->uri);
|
$_GET['uri'] = explode('/', $this->uri);
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
"methods": ["GET"],
|
"methods": ["GET"],
|
||||||
"controller": "page:load",
|
"controller": "page:load",
|
||||||
"arguments": {
|
"arguments": {
|
||||||
"page": "[a-z]+",
|
"page": "\\w+",
|
||||||
"uri": ".*"
|
"uri": ".*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
<?php http_response_code(404); ?>
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||||
|
<title>Erreur 404 - Ressource introuvable</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
La ressource est introuvable.
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
<?php die(); ?>
|
Loading…
Reference in New Issue