最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

next.js - Vercel NextJS: How can I redefine the route of 404 error page - Stack Overflow

programmeradmin0浏览0评论

On NextJS (deployed in Vercel), by default, the 404 error page is /404. I need to change it to /errors/404.

I've tried reading the docs () and even asking to ChatGPT o3-mini-high, and there is no answer at all.

My problem is that my app/website show user-pages on /xxx, and the app got viral sooner than expected (getnofilter), and somebody registered the "404" username, so now /404 should show the user instead of the error page. Like /brodanoel (/[username]).

I'm using NextJS 14, and with the old folder routing (/pages/[username]/index.js)

Thanks in advance!

PD.: Yes, I already registered the error user, so I don't have a problem with /error/404 hahaha

On NextJS (deployed in Vercel), by default, the 404 error page is .com/404. I need to change it to .com/errors/404.

I've tried reading the docs (https://vercel.com/guides/custom-404-page) and even asking to ChatGPT o3-mini-high, and there is no answer at all.

My problem is that my app/website show user-pages on .com/xxx, and the app got viral sooner than expected (getnofilter.com), and somebody registered the "404" username, so now .com/404 should show the user instead of the error page. Like .com/brodanoel (.com/[username]).

I'm using NextJS 14, and with the old folder routing (/pages/[username]/index.js)

Thanks in advance!

PD.: Yes, I already registered the error user, so I don't have a problem with .com/error/404 hahaha

Share Improve this question edited Feb 6 at 18:47 Broda Noel asked Feb 5 at 21:54 Broda NoelBroda Noel 1,9801 gold badge24 silver badges39 bronze badges 3
  • 1 Are you running the app on Vercel? – grekier Commented Feb 6 at 14:19
  • @grekier, yes, sir. – Broda Noel Commented Feb 6 at 18:47
  • 1 Then you could have a vercel.json to use another file. See vercel.com/guides/… – grekier Commented Feb 6 at 19:50
Add a comment  | 

1 Answer 1

Reset to default 0

As @grekier mentioned in the comments, the solution is: https://vercel.com/guides/custom-404-page#what-if-i-need-to-name-my-404-file-something-different

发布评论

评论列表(0)

  1. 暂无评论