DEV Community

Discussion on: Should I host two websites on a single domain?

Collapse
 
crimsonmed profile image
Médéric Burlet

sub domain

You can use a sub domain to redirect mobile users to m.domain.com and keep the domain.com for web users.

This is something that is done on facebook for instance as the mobile app is much lighter than the browser.

middleware

Depending what you are using you can have a middleware that will point oto the proper place.

for instance this can be done easily on express where you would get the files from different folders but they would be served on domain.com

codeforgeek.com/how-to-detect-devi...

Collapse
 
imkevdev profile image
Kevin Farrugia

Thank you Mederic.

The implementation itself is not an issue as we have separate servers and a load balancer will handle the redirection (whether to a separate subdomain or same).

My question is more, which would you choose and why? Why subdomain? Why same domain? Does it make a difference?