Is this sort of middleware rewrite/redirect possible?
Unanswered
Short-eared Owl posted this in #help-forum
Short-eared OwlOP
I have a (medusajs) project, where the entire application sits behind a dynamic route called
What I would prefer is to have a default
Is this sort of thing possible?
[countryCode]. So, you end up with urls like https://example.com/us or https://example.com/de.What I would prefer is to have a default
countryCode, where in the event that a user visits / (without a countryCode), or visits /${defaultCountryCode}, they will not see that countryCode in the url bar, while the inner page should still be able to access params.countryCode, in order to retrieve the countryCode and in that instance, should be the default countryCode.Is this sort of thing possible?
next-intl accomplished this sort of behavior with their as-needed prefix routing. However, I'm led to believe that changes to the next.config file may need to be made to accomplish this. In my instance, all regions are fetched dynamically in middleware and cannot be hardcoded, so this can be an issue.