Next.js Discord

Discord Forum

Potentially rework of the file-based router

Unanswered
American black bear posted this in #help-forum
Open in Discord
American black bearOP
Hello guys. I have a situation where my application is hosted on two different URLs, but the instance is one (the second URL is just masking). The code is the same. At this moment, my application sends requests to the BE server (with information from which URL the FE server tries to send requests) and builds most of the pages at the build time (SSG). The content of those sites is the same.

Now, I have a requirement to have the same instance and a few masking URLs but leave SSG. Is there any chance to create some logic which will build all pages and re-route in some type of middleware from which folder the application should pick the page?

For example, we have a "topic" page located in /pages/topic/index.js folder. That topic page should have different content for all instances. I think about it that example1.com/topic should get /pages/example1/topic, and example2.com should get /pages/example2topic.

I just wan to know if there is any chance of doing this.
Thank you guys a lot!!

0 Replies