Next.js Discord

Discord Forum

handle multiple domains

Unanswered
Spectacled Caiman posted this in #help-forum
Open in Discord
Spectacled CaimanOP
my next app is "domain1.com" for example

i have an endpoint,
domain1.com/users/:id

how could i also get a 2nd domain to render this route?
domain2.com/id

I would use redirects but I want the page to actually be rendered under this domain

11 Replies

@Spectacled Caiman solved?
domain1.com is the original next app
domain2.com is just another domain used for short url

domain1.com/users/[id] === domain2.com/[id]

but im not sure how to attach the other domain as it isn't running on a port like domain1
@B33fb0n3 one solution would be to use a CNAME to point all domains to one app that handles the short url
Spectacled CaimanOP
which domain would i add the cname to?

domain1.com (original next host)
domain2.com (short url)
i presume the short url
yes the short url.
Then it's like
short.com -> domain1.com (nextjs) -> nextjs now handles the short
@B33fb0n3 yes the short url. Then it's like short.com -> domain1.com (nextjs) -> nextjs now handles the short
Spectacled CaimanOP
but cname is just an alias and not a http redirect
@Spectacled Caiman but cname is just an alias and not a http redirect
CNAME keeps the current url, but loads a different in the background
@Spectacled Caiman solved?