问题
-
当你写完多个页面,exoprt静态页面后,放在服务器上直接访问某个子页面****,发现直接访问给你返回了个404,你去查看目录结构,发现nextjs工具给你生成了register.html。而不是/register/index.html。自然会返回404
解决办法
-
官方文档也有提及
修改next.config.js 。添加 exportTrailingSlash: true
module.exports = withLess({ exportTrailingSlash: true, // make /about becomes /about/index.html and is routable via /about/. lessLoaderOptions: { modifyVars: { 'primary-color': '#9324af', 'secondary-color': '#333333' }, javascriptEnabled: true }, })
文章评论
感谢分享