Next.js: Add subdomain routing example

Created on 15 Nov 2018  路  7Comments  路  Source: vercel/next.js

Nextjs is awesome framework, but i have website with subdomain

  • blog.domain.com
  • forum.domain.com

I want to handle them with single app with nextjs, like laravel routing system allow use multiple subdomain on single app

Most helpful comment

hopefully, Vercel will implement subdomain routing in the near future. a subdomain would be very useful in organizing links and pages.

All 7 comments

Does zones not cover your use case?

Hello @ardyfeb,

did you find any solution for easy subdomain routing with serverless target app?

Any input for this topic? It's possible to create multiple zones with a different subdomain and not based on the URL path? Thanks for this awesome tool!

Any updates on this topic? Would really love to have subdomain routing.

hopefully, Vercel will implement subdomain routing in the near future. a subdomain would be very useful in organizing links and pages.

I don't know if this is the right way to do this. But I'm able to reroute NextJS pages to subdomains using a custom express server. See: https://github.com/dcangulo/nextjs-subdomain-example

@dcangulo thank you for your example. However, your example assumes you create custom server. It will not work with serverless approach which has many benefits.

Was this page helpful?
0 / 5 - 0 ratings