Sub-domains and redirects simplify web access
|Sub-domains are useful. When you have your own domain name and a hosting account, you can create sub-domains.
Domain extensions such as .com and .ca are called top-level domains (TLDs). A second-level domain is a domain that is directly below a top-level domain, such as webhostingbuzz.com. Thatâs what we usually think of as a domain name which we can register. The next level down would be a third-level domain, also called a sub-domain, such as sales.domain.com or www.domain.com.. In fact, there can be multiple levels of sub-domain.
cPanel makes it easy to create sub-domains, as itâs done through a web-based interface and all the hard work is done automatically. By default, a cPanel sub-domain of dog.domain.com would have its URL resolve to domain.com/dog, but you can change that using a redirect. Combining a sub-domain with a redirect makes it possible to have short, elegant looking URLs that resolve to deeply nested paths.
For example, to more easily access each of the cPanel webmail clients via SSL, I made three sub-domains each redirected to an https URL:
- horde.domain.com redirects to https://domain.com:2096/horde/
- round.domain.com redirects to https://domain.com:2096/3rdparty/roundcube/
- squirrel.domain.com redirects to https://domain.com:2096/3rdparty/squirrelmail/
To create a redirected sub-domain in cPanel:
- Click Subdomains.
- Click Create a Subdomain.
- Enter the desired sub-domain name.
- Click Create.
- When you see the message indicating that the sub-domain was created, click Go Back to return to the Subdomains screen.
- Under the Modify a Subdomain section, click Manage Redirection.
- Enter the path to which you want the sub-domain to resolve, and click Save.
- Enter the new sub-domain in your browser, e.g. .sub.domain.com, to see it work.
When working on early frameworks for a client web site, they might be accessed at a nested folder such as domain.com/clients/workshop/empire-surfboards/master.php. I create a sub-domain redirected to that URL. Itâs far easier for me to remember empire.domain.com, and easier for my client.
When travelling, I often upload digital maps, itineraries and other useful documents to my web server. These serve as accessible backups for me, in case I lose the paper files Iâm carrying, and family can also access these. Again, to simplify access I create a redirected sub-domain such as france.domain.com.
Once you realize how convenient redirected sub-domains can be, and how easy they are to create, Iâm sure youâll think of plenty of uses.