diff --git a/app/[lang]/(live)/(protected)/my-pages/page.tsx b/app/[lang]/(live)/(protected)/my-pages/page.tsx index ce3c31901..c5e0a31ff 100644 --- a/app/[lang]/(live)/(protected)/my-pages/page.tsx +++ b/app/[lang]/(live)/(protected)/my-pages/page.tsx @@ -18,10 +18,6 @@ export default async function MyPages({ throw new Error("Bad URI") } - const myPagesRoot = myPages[params.lang].replace(`/${params.lang}`, "") - if (searchParams.uri === myPagesRoot) { - redirect(overview[params.lang]) - } const accountPage = await serverClient().contentstack.accountPage.get({ url: searchParams.uri, lang: params.lang, diff --git a/next.config.js b/next.config.js index dc8b453d2..99b3cf58a 100644 --- a/next.config.js +++ b/next.config.js @@ -72,6 +72,35 @@ const nextConfig = { return config }, + redirects() { + return [ + { + source: myPages.da, + destination: overview.da, + permanent: false, + }, + { + source: myPages.de, + destination: overview.de, + permanent: false, + }, + { + source: myPages.fi, + destination: overview.fi, + permanent: false, + }, + { + source: myPages.no, + destination: overview.no, + permanent: false, + }, + { + source: myPages.sv, + destination: overview.sv, + permanent: false, + }, + ] + }, rewrites() { return { beforeFiles: [ @@ -102,12 +131,6 @@ const nextConfig = { { source: login.no, destination: "/no/login" }, { source: login.sv, destination: "/sv/login" }, - { source: myPages.da, destination: "/da/my-pages/overview" }, - { source: myPages.de, destination: "/de/my-pages/overview" }, - { source: myPages.fi, destination: "/fi/my-pages/overview" }, - { source: myPages.no, destination: "/no/my-pages/overview" }, - { source: myPages.sv, destination: "/sv/my-pages/overview" }, - { source: overview.da, destination: "/da/my-pages/overview" }, { source: overview.de, destination: "/de/my-pages/overview" }, { source: overview.fi, destination: "/fi/my-pages/overview" },