|
|
@@ -18,6 +18,19 @@ const nextConfig: NextConfig = {
|
|
|
experimental: {
|
|
|
trustHostHeader: true,
|
|
|
} as NextConfig["experimental"],
|
|
|
+ /**
|
|
|
+ * 必须在配置层做根路径重定向:`app/page.tsx` + permanentRedirect 会被预渲染为静态 ○ /,
|
|
|
+ * 线上容易出现「必须手输 /zh」;redirects 在路由层优先匹配,且 destination 为相对路径,不会错写成 :3000。
|
|
|
+ */
|
|
|
+ async redirects() {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ source: "/",
|
|
|
+ destination: "/zh",
|
|
|
+ permanent: true,
|
|
|
+ },
|
|
|
+ ];
|
|
|
+ },
|
|
|
async rewrites() {
|
|
|
const rewrites = [];
|
|
|
if (apiProxyTarget && /^https?:\/\//i.test(apiProxyTarget)) {
|