Next.js Discord

Discord Forum

Help with Redirecting w/ Static export

Unanswered
Highlander posted this in #help-forum
Open in Discord
Avatar
HighlanderOP
Hello! I have a app that uses static export and was hoping to get help on solutions that would allow me to have my webapp route to /page.html by default when navigating to /index.html.

Note: I saw that there was the exportPathMap that used to be able to do this but was deprecated. When I checked getStaticPaths (for page router) I was able to see the redirect option in documentation but I see nothing mentioned with generateStaticParams (for app router).

https://nextjs.org/docs/pages/api-reference/next-config-js/exportPathMap

export default function IndexPage() {
  const router = useRouter();

  useEffect(() => {
    router.push('/explorer.html');
  }, []);

  return null;
}

1 Reply

Avatar
HighlanderOP
bumping up!