如果在IIS上部署nextjs,如果没有nextjs页面,是否有一种默认返回IIS路由的方法?
我想使用nextjs作为我的主页和wiki等,但是如果没有页面jsx,还有其他直接从IIS路由的页面吗?
( Eg)
发布于 2022-04-01 19:41:56
两种选择
/viewer -> /iis/viewer/index.htmlgetInitialProps中设置一个ctx// Modified from https://github.com/vercel/next.js/discussions/16749#discussioncomment-1604423
if (ctx.res.statusCode === 404) {
res.writeHead(301, { Location: '/iis/'+ctx.asPath })
res.end()
}请注意,IIS接收404页时必须在IIS端设置适当的处理。
https://stackoverflow.com/questions/71711573
复制相似问题