php
php copied to clipboard
How to handle and create custom 404 page
Question
How to handle and create custom 404 page
Hi @Jobians.
I would use routes to provide custom 404 page.
{
"functions": {
"api/**/*.php": {
"runtime": "[email protected]"
}
},
"routes": [
{ "src": "/users/(.*)", "dest": "/api/users.php" },
{ "src": "/orders/(.*)", "dest": "/api/orders.php" },
{ "src": "/(.*)", "dest": "/api/error.php" }
]
}
@f3l1x
I used this from vercel documentation but it not working
{ "functions": { "api/**/*.php": { "runtime": "[email protected]" } }, "routes": [ { "src": "/(.*)", "dest": "/api/$1" }, { "src": "/(.*)", "status": 404, "dest": "/api/404.php" } ]
Can you share where is this example?
@f3l1x https://vercel.com/guides/custom-404-page#what-if-i-need-to-name-my-404-file-something-different