What exactly is a subdomain?

lydia09

New Member
Messages
64
Reaction score
0
Points
0
Hi everyone,
I was curious, can anyone explain to me what exactly a subdomain is? I did some research on it, and here's what I have so far:

1. A subdomain is a specific section of a web site, accessed like: subdomain.domain.com
2. A subdomain is served out of a folder in your web root.
3. A subdomain can make users' browsing faster.
4. A subdomain causes that particular area of your site to be indexed better by search engines.

Now, I'm not fully sure if all this is right, but this is how I understand it at the moment.

So... it seems to me, based on this, that you should be able to make a subdomain by creating any old folder in your web root, and then you can access it like: myFolder.mySite.com. Apparently, however, this isn't the case. This makes me very confused.

Then, what exactly is it about subdomains that makes them so special, and able to behave the way they do? I'm not planning on making any, because x10hosting limits us to 3, but I'm just curious, for my own reference, how exactly do subdomains work? Can anyone explain this to me, please?

Thanks,
Lydia
 
Last edited:

Smith6612

I ate all of the x10Pizza
Community Support
Messages
6,517
Reaction score
48
Points
48
They work by allowing you to enter in an address to a folder on your website without having to go through the whole thing of knowing the full file path. For example, take x10hosting.com. x10hosting.com is the primary domain, where as forums.x10hosting.com is the subdomain. The forum software could however be installed at www.x10hosting.com/mainsite/forums, but the subdomain makes it much easier to remember and makes things look cleaner.

That's the way I can put it.
 

Twinkie

Banned
Messages
1,389
Reaction score
12
Points
0
I believe he understands that, but wants to know the technical aspect of it. I don't know how Apache works...
 

vishal

-::-X10 Guru-::-
Community Support
Messages
5,255
Reaction score
192
Points
63
A Apache config file looks like this ,we can also use server alias
<VirtualHost aaa.bbb.ccc.ddd>
ServerName www.domain.com
ServerAdmin webmaster@domain.com
DocumentRoot /path/to/your/document_root
ServerAlias sub.domain.com
</VirtualHost>
 

lydia09

New Member
Messages
64
Reaction score
0
Points
0
Thanks everybody,
So, basically what I'm getting from this is that a subdomain is created by a virtual host of some kind, which means you can do something like this:

<VirtualHost http://sub.mydomain.com>
ServerName http://domain.com
DocumentRoot /path/to/your/document_root
ServerAlias sub.domain.com
</VirtualHost>

And then some magic happens behind the scenes to create a subdomain? Is that how it works? I tried temporarily creating a subdomain, just for kicks, but I didn't see an .htaccess file involved, so I have a feeling that means I'm missing something.

Thanks,
Lydia
 

vishal

-::-X10 Guru-::-
Community Support
Messages
5,255
Reaction score
192
Points
63
if u r subdomain is working then fine dont bother about the .htacces
 

mcnigelmcgruff

New Member
Messages
17
Reaction score
0
Points
0
Subdomains are simply a way to sub-divide a domain name that you have control over. Originally, subdomains were simply different servers (i.e. www = primary webserver; mail = email server). Now that web protocols have advanced, subdomains can be used for many things. I think your confusion comes from the way that domains are used, so let's break it down:
If you access a site using this path:
http://books.read.us.thisdomain.com/funstuff/readmeone.html
then you are providing your computer with a lot of information as to what to get and how to get it.
-The "http://" piece tells the browser to use the http protocol
-"books" represents the name of the server that the file resides on
-"read" represents a subset of "us" which is a subset of "thisdomain" which is a subset of "com" which is a subset of the root of the DNS tree
-"/funstuff/" is the directory under the root that the file resides in
-"readmeone.html" represents the file (this file could be a web page) that you want to get

Now this is the basic way it works; because things like DNS and virtual hosts and directories are very flexible, there can be many tricks that web hosts use:
-"books" doesn't necessarily have to the be the name of the server. It could be anything else, this is entirely determined by DNS. For instance, where I work the real name of our email server is "midas", but to access it you use "mail"
-"read" being a subset of "us" can be complicated, too. Some domains just use it with DNS to split the domain into subsections, others use it for delegation. For instance, when you get a free domain from x10hosting (whatever.x10hosting.com), the people that own x10hosting use DNS to give you control over the whatever section of their domain.
-If you create a directory under your root, it will be shown after the DNS portion is finished. (i.e. "/funstuff/"). This can simply be managed by creating folders under your web root.

Most of what is explained above is generic. It is simply the way the web works. However, because sites out there want things setup a certain way, admins use many tricks and advanced features to make it happen. Subdomains are primarily a DNS feature, so I would do some more research into the way DNS works before you make any changes to your account.
 

espfutbol98

New Member
Messages
200
Reaction score
2
Points
0
I think you also have to make a DNS MX record pointing the subdomain to the server IP as well. This can be done, for example, on godaddy.com under "total DNS control".
 
Last edited:

mcnigelmcgruff

New Member
Messages
17
Reaction score
0
Points
0
I think you also have to make a DNS MX record pointing the subdomain to the server IP as well. This can be done, for example, on godaddy.com under "total DNS control".

DNS MX records only apply if you intend to receive email using that specific domain name. In the case of cPanel, they are usually generated automatically. But you are correct in the likely location for creating a subdomain (under a DNS management tool). Or in cPanel, if you are using x10.
 

slacker3

New Member
Messages
146
Reaction score
6
Points
0
Thanks everybody,
So, basically what I'm getting from this is that a subdomain is created by a virtual host of some kind, which means you can do something like this:

<VirtualHost http://sub.mydomain.com>
ServerName http://domain.com
DocumentRoot /path/to/your/document_root
ServerAlias sub.domain.com
</VirtualHost>

And then some magic happens behind the scenes to create a subdomain? Is that how it works? I tried temporarily creating a subdomain, just for kicks, but I didn't see an .htaccess file involved, so I have a feeling that means I'm missing something.

Thanks,
Lydia

you need an A or CNAME resource record in your DNS server
for each subdomain you want to create

(they could all point to the same IP/hostname - apache decides
what to serve by the requested hostname)
 
Last edited:

hernandez9039

New Member
Messages
19
Reaction score
0
Points
0
[FONT=Verdana, Geneva, Arial, Helvetica, Sans-Serif]A subdomain name would be a "name *under* your domain name", something like "subdomain.yourdomain.com".
_______________________________________________________
Web Design London
[/FONT]
 

mr kennedy

Member
Messages
524
Reaction score
1
Points
18
Hi everyone,
2. A subdomain is served out of a folder in your web root.
Not necessarily. It depends on how your subdomain is configured. For example, your domain name is 'lydia09.com' and you wanted to create say a subdomain named 'forums'. cPanel by default creates a folder on your server root named what ever your subdomain name is. so it's gonna be 'forums.lydia09.com' and the folder 'forums' is gonna be at your root which basically means you can also access 'forums.lydia09.com' at 'lydia09.com/forums'. That is IF you left the settings at subdomain creation. It can also be served outside the 'public_html' folder say your root folder. It will be accessible yes but only from 'forums.lydia09.com'


3. A subdomain can make users' browsing faster.

Again, not necessarily. If it is served from the same server as your domain, it will be just like the speed of your main site.

4. A subdomain causes that particular area of your site to be indexed better by search engines.

Yet again, not necessarily. It's always a good practice to have a site map on your site for SE's to see almost every content in your site ;)
 

k.t. kenneth

New Member
Messages
1
Reaction score
0
Points
0
http://xxx.yourdomain.com

xxx is the subdomain

eg. http://abc.yourdomain.com

abc is a subdomain of yourdomain.com
 
Last edited:
Top