404 error code example
Example 1: 404 error
Check this cool 404 error page!
https://codepen.io/DevLorenzo/pen/poEXVZp
Example 2: how to set 404 page in laravel
public function render($request, Exception $exception)
{
if ($this->isHttpException($exception)) {
if ($exception->getStatusCode() == 404) {
return response()->view('errors.' . '404', [], 404);
}
}
return parent::render($request, $exception);
}
Example 3: express 404
app.use(function(req, res, next){
res.status(404);
if (req.accepts('html')) {
res.sendFile('index.html');
return;
}
if (req.accepts('json')) {
res.send({
status: 404,
error: 'Not found'
});
return;
}
res.type('txt').send('404 - Not found');
});
Example 4: server 404 response
status code 404. Not Found.