Next.js Discord

Discord Forum

different route name as directory

Unanswered
Sweat bee posted this in #help-forum
Open in Discord
Sweat beeOP
Is it possible to name your app folder something like app/business-customer but in the url of the browser make it available under www.domain.de/geschaeftskunden?

15 Replies

Sweat beeOP
only way what comes into my mind is using middleware and redirecting... but will the url stay the original way then?
Allegheny mound ant
You can use () to group routes in your project.

app/(business-customer)/geschaeftskunden
European sprat
You want "business-customer" directory for organization?
Sweat beeOP
I want my project structured in engl. but its a german website
with german subfolders
its like you have a subfolder called products but I want it accesable under /produkte
European sprat
Sweat beeOP
looks good I am gonna try this
European sprat
I changed the link to app router
Sweat beeOP
I dont know if that makes even sense what I want to do... 🙂 Maybe I should just use the german naming for the subfolder under app?! What do you think?
European sprat
If you can read German then I'd just do that
European sprat
I don't think that changes route naming
Either use German names in the dirs or try rewrites but the rewrites might be hard to maintain if you have a lot of pages
Allegheny mound ant
You might use a dynamic route, then use a middleware to check if the route value is in either routes_EN.json or routes_DE.json, and take it further from there.