First of all thank you for the release of this product!

I have an app nextjs that I export in static and so I have a folder containing all my pages with the .html extension.

When the site is loaded and I click on a link in the page (next/link) the redirection is done. However, when I refresh the page, I get a 404 because he can’t find the page and expects to get .html at the end of the url.

Is it possible to redirect the url to automatically?

Kind regards

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

2 answers

👋 @saikouah

App Platform doesn’t handle this type of routing. It will only do top-level routing. It sounds like you’ll want to use an internal router like next/router to handle routing inside of your app.

next/link works in the same way as next/router. You only have more freedom with the last one.
The problem does not come from there but from the resolution of the routes directly.

1) Go to -> Click link => works
2) Go to directly => does not work because there is no file that resolves this route.
3) Go to => works

The only solution for the moment is to deploy a webserver and run the next start command.
But in doing so I lose the capability of the cdn? Or create another component that contains the deployment of the output of the next build (_next dir and other files) and have a webserver component that will run next start.

Submit an Answer