A subdomain is anything that appears before your master domain in the URL, and is based on dns. It is technically a third level domain name, and requires a change to your zone file.
It is important to note, you could have a custom dns setup - for example:
You host with the John Doe hosting company. However, your dns is handled by someone else, maybe
your isp, lets say. This can be extremely confusing, so be prepared. To get started; contact
your web host and they should be able to point you in the right direction, and can
tell you what steps you need to take, and can tell you who your dns authority is.
Depending on how your webhost is setup there are several different ways subdomain hosting setup is handled. These are only a couple, and apply to Unix web hosting with an Apache webserver:
Wildcard dns can be used, a subdomain setup with no further action - except
for the creation of a folder and an htaccess text file on the webmasters part. Multiple subdomains (or
machine names) - can be set up this way with no assistance from system admins,
all you need to do is create a folder, and an htaccess file with a rewrite rule.
The dns will then resolve the subdomain. A subdomain can be pointed off the
host server as well, to another ip address entirely.
This is written in your zone file like so:
* IN A 123.123.123.123
Or; you can create a subdomain; it's written in the dns zonefile; and you can use either .htaccess or httpd.conf to redirect to the folder that you have created for the subdomain. (Windows uses host headers, and usually must be configured by a system admin.) This is written in your zone file like so:
dick IN A 123.123.123.123
or
jane IN A 213.213.213.213
(if you want the subdomain pointing to another server.)
The .htaccess file you would create for either of the above cases will look like this:
RewriteEngine On
Options +FollowSymlinks
RewriteBase /
Rewrite Rule for jane.domainname.com
RewriteCond %{HTTP_HOST} jane.domainname.com$
RewriteCond %{REQUEST_URI} !jane/
RewriteRule ^(.*)$ jane/$1
This tells anyone that is going to https://jane.domainname.com to go to the folder jane on domainname.com. This file is named .htaccess (it is a "hidden" file) and is then uploaded to your
root directory.
You can reach the subdomain either by https://domainname.com/subdomain/ or https://subdomain.domainname.com.
There is a third way; if you host with us; is simply to setup the domain in your control panel, where the process is automated. All you need to do is create the folder, no need for an .htaccess file. You can find instructions on Adding a subdomain here.