Page routing with multiple domain
How can I use multiple (sub)domains within a single Nuxt project (e.g.
pages/<domain>/about.vue
)? I know nuxt/i18n somehow does it but I was unable to figure out how exactly it does it.3 Replies
Hi @Septatrix. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
I apologize, but I don't have enough information in the provided knowledge sources to directly answer your question about using multiple (sub)domains within a single Nuxt project for page routing. The documents don't contain specific information about implementing domain-based routing in the way you described.
However, I can provide some related information about Nuxt routing that might be helpful:
1. Nuxt uses file-system based routing, where pages in the
pages/
directory automatically generate corresponding routes Docs > Getting-started > Routing (https://nuxt.com/docs/getting-started/routing).
2. Nuxt supports dynamic routing using file and directory names with square brackets, like **id].vue
[Docs > Getting-started > Routing > Pages (https://nuxt.com/docs/getting-started/routing#pages).
3. For more complex routing needs, Nuxt allows extending routes using the extendRoutes
option in the router
configuration or through Nuxt modules Docs > Guide > Recipes > Custom Routing > Nuxt Module** (https://nuxt.com/docs/guide/recipes/custom-routing#nuxt-module).
While these features don't directly address your multi-domain routing question, they might provide a starting point for implementing a custom solution. For a more specific answer about multi-domain routing, you might need to consult additional Nuxt documentation or community resources not included in the provided knowledge sources.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@525348219828568076> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
I still want to have different pages for each domain. Maybe layers are better for this?
The sites only need to share some components, middleware, and few configs between the sites. And ideally they would also be served by a single nitro instance
But does that also for work splitting API routes into
/server/api/foo.com
and /server/api/foo.org
?
Ah right, thanks for your help :)