How to assign a sub-domain to each user but still serve them from the same code instance?

85 Views Asked by At

How do sites like Wordpress.com assign a unique sub-domain to each user but still, I assume, support them all on the same instance? What is the process of automatically managing the DNS entries? Is there an advantage to supporting different users under their own sub-domain (e.g. client1.service.com) versus a separate path (e.g. service.com/client1)?

1

There are 1 best solutions below

2
On BEST ANSWER

This is usually done through a combination of DNS wildcards and dynamically auto-configuring web server setups. This means no continuing DNS (or web site) configuration is necessary as all possible hostnames +server instances automatically exist.

Having users under their same domain can help with isolating data (instead of having all users' data on a single hostname, each hostname has only a single user's data) and make the web site seems more personalized.