php icon indicating copy to clipboard operation
php copied to clipboard

How to handle and create custom 404 page

Open Jobians opened this issue 2 years ago • 4 comments

Question

How to handle and create custom 404 page

Jobians avatar Sep 05 '22 08:09 Jobians

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 avatar Sep 09 '22 10:09 f3l1x

@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" } ]

Jobians avatar Sep 09 '22 10:09 Jobians

Can you share where is this example?

f3l1x avatar Sep 09 '22 11:09 f3l1x

@f3l1x https://vercel.com/guides/custom-404-page#what-if-i-need-to-name-my-404-file-something-different

Jobians avatar Sep 09 '22 11:09 Jobians