308 重定向
方式一:页面
// pages/about.js
export async function getStaticProps(context) {
return {
redirect: {
destination: '/',
permanent: true, // triggers 308
},
};
}
方式二:配置
//next.config.js
module.exports = {
async redirects() {
return [
{
source: '/about',
destination: '/',
permanent: true, // triggers 308
},
];
},
};