add domain redirect

This commit is contained in:
Zhe Li 2023-03-31 11:28:42 +08:00
parent e3a7137bf8
commit 6d80f4c098
1 changed files with 21 additions and 1 deletions

View File

@ -11,7 +11,27 @@ const nextConfig = {
}); // 针对 SVG 的处理规则
return config;
}
},
async redirects() {
if (!process.env.DOMAIN) {
return []
}
return [
{
source: '/',
destination: `https://${process.env.DOMAIN}/`,
has: [
{
type: 'host',
value: process.env.DOMAIN,
not: true
},
],
permanent: true,
},
]
},
};
if (process.env.DOCKER) {