I'm trying to add sub domain to my Next.js application to make dynamic domain pages. For example: sub.domain.com.
I have tried to use **Redirect **function in the next.config
file like this, but it's a bit tricky:
const nextConfig = {
async redirects() {
return [
{
source: "/:path*",
destination: "/",
permanent: true,
},
];
},
};
module.exports = nextConfig;