Websites and Portals are getting bigger. Content is all over the place. As a result, it is not always possible to fit into one we template or content management system.
More webmasters are using sub-domains to attract new visitors, to keep traffic from getting lost.
What is a subdomain really? A subdomain is the part of the website address before the domain name. For example, the address for Google Finance is http://finance.google.com. Here, finance is a subdomain of the domain name google.com. Subdomains are also known as the third- level domains, or canonical names. A subdomain, unlike a domain name, is not registered separately because it is associated with main domain name. It can be created by the web host on the DNS server. The most commonly used subdomain is www, as in http://www.google.com. However, there is no need to add www in front of the domain name. Similarly, mail server addresses often have mail as the subdomain, as inhttp://mail.google.com.
Why are subdomains used?
Subdomains are commonly used to categorize or differentiate portions of the website. For example, the services offered by Google are categorized by their subdomains, such as code.google.com, sites.google.com, analytics.google.com, adwords.google.com. The benefit is that one subdomain can be easily moved to another server if the category gets very popular, or has different development or usage needs.
Sub-domains are also used by free web hosting providers to resell web space under their own domain name (e.g.http://membername.hostname.com). Each member will have their subdomain, however, they all will still share the domain name of the hosting provider.
Another reason for using a subdomain name is to load balance the web servers for a high traffic website. Multiple web servers are assigned different subdomains like www.sitename.com, www1.sitename.com, www2.sitename.com etc, though each of them contain the same application code. When the request comes from the browser, the load balancing software redirects it to one of these servers. DNS load balancing is a simple method of load balancing using subdomains pointing to different IP addresses.
Types of subdomain setup
A subdomain can be setup in different ways, although the subdomain information is stored similarly in the DNS server.
- Separate Site: This type of subdomain setup has a separate hosting account or hosting location with respect to the domain hosting account. The hosting provider usually assigns new resources (disk space, bandwidth etc.) for this subdomain and charges fees as if it is another hosting account. There is often no way to share common files (such as include files by relative path) between the domain account and subdomain account.
- Sub-Directory Pointing: In this case, the subdomain is pointed to a sub-directory of the web root folder. For example, subdomain.maindomain.ext will point to /mainaccount/www/subdomain directory. Essentially, the resources of the domain in this case are also shared by the subdomain. Most times, the hosting provider will not charge additional fees (domain forwarding is a different matter). Both the domain and subdomain can also reuse the same common files (such as SSI includes) from the same shared directory location.
- Separate Server: This type of configuration is similar to the separate site configuration but hosted on a separate server with a different IP address. In this case the subdomain can reside at a totally different geographical location. This is used to serve the local customers without delay as it helps with load distribution among servers (by separating application functionality) or providing horizontal scaling between servers (by identical replication of application code on each server).
Notice the url of this website – it is go.websitein24hours.com. A different application, a different server provider.