Next.js Discord

Discord Forum

Same folder in /app and /public for subitems?

Unanswered
elfensky posted this in #help-forum
Open in Discord
I am using nextjs 13 with approuter and SSG (output: 'export';)

I have an /archive/page.js that contains links pointing to old versions of the same website.

I want to put the old static websites under /archive/sites1/... , but I dont want to recreate them in nextjs.

Ideally, I would put them in /public/archive/site1/index.html, but documentation says you're not allowed to use the same name for folders in your app directory and public directory.

How can I best solve this?

3 Replies

You could serve the file on like public/old/... and then use https://nextjs.org/docs/pages/api-reference/next-config-js/rewrites to rewrite the old url's to point to those public folder.

I don't know if that's the best solution, but its the first thing I can think of.
rewrites do not work with output: 'export'
Right my apologies, I didn't catch you were using exports.

In that case, you should be fine with first doing an export from next, and then adding in your static files.

Since it'll all be html/css/js that should work just fine.