So i have built an application which allows companies to sign up. Once the company have created an account they can then add their own users.
So i have a database which contains all companies and users just separated by a company ID essentially.
Now the way i have it at the minute is that they just log in at the main website, but i came across another web application that creates a subdomain for each company that signs up.
For example company1.mywebsite.com and the next company would be company2.mywebsite.com.
How can i achieve this so that when a company signs up it automatically creates a new subdomain which their company name first?