A subdomain also called a child domain, is part of a larger domain name in Domain name system (DNS) hierarchy. DNS hierarchy consists of the root-level domain at the top, below which there are the top-level domains, then second-level domains and finally subdomains
The Domain name system (DNS) mainain a hierarchy, with each non-RR (resource record) node on the hierarchy being a domain name.
Suppose a domain
www.jquerytraining.com then the subdomain of the website may be
Generally, a subdomain is preferred over a sub-directory in cases where the content of the sub-domain is not related to the content of the main site.
Everybody looking for better solution for dynamic sub domain for their domain, like Google Blogger and Tumblr.com.
Traditionally, a subdomain in PHP is created manually from the cpanel. To do so, a developer has to enter information such as the name of the subdomain, the domain under which it has to be created.
This process works completely fine if there is only one or a two sub domains to be made. But often, there arises a situation when multiple subdomains are needed to be created dynamically on user actions such as in the case of websites like Tumblr.com.
The following steps are to be taken to setup dynamic sub domain.
Open the domain admin panel
Go to your domain DNS(Domain Name System) settings -> click add zone record.
Now we need to create a custom A record to serve all your subdomains.
Select A record, HOST * POINTS TO: Your IP Address
Repeat the same for HOST @, here is the listed A records.
Now add CNAME record, HOST www POINTS TO @ this refers to your IP address.
CNAME list should be in following way. then save
This is the way we can create dynamic subdomain