How erpnext do a site base on subdomain

when you put your name on the browser as you go to a site from erpnext do create you site or your account, how they do that with i script?

It looks for the domain and if it does not find it, it redirects to the sign-up page.

close please