As you all know few sites offer feature which let you specify what type of url you would like to have. Mostly they are of type:
ABC.somedomain.com
DEF.somedomain.com
(Mostly these sites are blog/genealogy site.)
I do not quite understand how does it all work. How can I achieve this? Also, how can I test this on localhost to really see if all is working fine?
The domain is very important, an you will need a DNS mapping for the domain, and an IIS (or whatever web-server) mapping for the domain/subdomain (or alternatively: a wildcard mapping).
As part of adding the IIS mapping, you also need to decide whether those two domains are in the same IIS application, or 2 different applications. Different applications may be easier to configure (especially if they point to different folders on disk, with different configurations), but a shared application (multi-tenancy) can be more efficient in terms of fewer app-startups, etc. Of course, it helps if you’ve designed for multi-tenancy from the start, in terms of cache key names, configuration data, etc.