Creating Subdomains
Using cPanel
Assuming your site has cPanel (usually located at yourdomain.com/cpanel) login with the information given to you by your hosting company. If you don’t know if you have cPanel or if you don’t know how to log in you can skip to the second part about Using Your Hosts File.
After you login to your cPanel, go to “Subdomains” under the “Domains” category.
Now you want to Create A New Subdomain. Just type the subdomain you want, like dev, into the box that’s titled “Subdomain:” and click “Create”. Voila! All done!
Wildcard Subdomain
If you want to create a lot of subdomains an easy thing to do is use the wildcard. Instead of typing in a subdomain put in an asterisk ( * ) and this means that ANY subdomain is set up.
Using Your Hosts File
The Hosts file for your operating system maps domains to IP addresses. With this file you can tell the computer where to go when you type in a hostname into your browser. Normally when you type in a domain into your browser it checks the Domain Name System to find the IP Address but if you add a domain to the Hosts file it will check there first.
Syntax
IP address subdomain.domain.com
Example
127.0.0.1 dev.kwista.com
To create a subdomain, let’s say dev, first you need to find the IP address of your website by going using Network Tools and typing in your domain name. Once you get your IP address you type it on a new line in the Hosts file and then separated by at least one space or tab you add your subdomain with domain, like dev.yourdomain.com.
Where Is My Hosts File?
Your hosts file is located in a different place depending on your operating system. Use this chart to find your operating system
| Operating System | Version(s) | Location |
|---|---|---|
| Windows | 95, 98, Me | %WinDir%\ |
| NT, 2000, XP, 2003, Vista, 7 | %SystemRoot%\system32\drivers\etc\ (see note) | |
| Windows Mobile | Registry key under \HKEY_LOCAL_MACHINE\Comm\Tcpip\Hosts | |
| Macintosh | 9 and earlier | System Folder: Preferences or System folder |
| Mac OS X, iPhoneOS | /private/etc/hosts or /etc/hosts (/etc on Mac OS X is a symbolic link to /private/etc) | |
| Most Unix and Unix-like OSes POSIX | /etc/hosts | |
| Novell NetWare | SYS:etc\hosts | |
| OS/2 & eComStation | "bootdrive":\mptn\etc\ | |
| Symbian | Symbian OS 6.1-9.0 | C:\system\data\hosts |
| Symbian OS 9.1+ | C:\private\10000882\hosts (AllFiles capable only) | |
| Android | /system/etc/hosts |
