Table of Contents

How to create a subdomain

http://example.com and http://www.example.com are two very different addresses!

They are commonly thought of as being the same thing (which frequently causes confusion for people new to domain names that want to set up web forwarding), but they are not. One is a domain name, and the other is a subdomain.

What is a subdomain?

Think of it as a subordinate space of your domain.

Let's say that you have a simple website with Gandi's Simple Hosting service, and publish it at http://www.example.com. In this case, your site is hosted on the www subdomain.

But what if you want to have a blog too? One that does not interfere with the website? Easy: simply set up your blog on a different subdomain, such as blog. Visitors can then access your blog at http://blog.example.com and your website still at http://www.example.com.

Do you want to publish your photo album that you made with Sitemaker too? No problem: put it on another subdomain, such as photos. Your album will be visible at http://photos.example.com, and your other sites will not be affected in the slightest.

Anything else? Perhaps a wiki that you host on a VPS? Again, just add another subdomain….

Subdomain Domain
wwwexample.com
blogexample.com
wikiexample.com
photosexample.com
anythingexample.com

I get it - so how do I make a subdomain?

The first thing that you need to to is to add a line in your DNS zone file.

The purpose of this zone file entry is to tell the name servers:

  1. that a subdomain exists, and
  2. where to find the website associated with that subdomain.

Let's say you want to “point” www.example.com to a Gandi Simple Hosting server. To do this, you'll need to add an entry in your DNS zone file similar to this one 1):

www 10800 IN CNAME gpaas1.dc0.gandi.net.

(Don't forget the dot at the end of the CNAME entry or it will not work!!!)

And perhaps you have a mobile phone website hosted by Wix and you need a ”m” subdomain, then you just add a line like:

m 10800 IN A 216.139.213.144 

etc.

Your host will tell you whether or not you need to add an IP address or a subdomain. If it is an IP address that you need to use, then you'll create an A record. If you are given a domain name (like web.me.com, ghs.google.com, etc.) then you need to make a CNAME record.

The changes to the zone file can only be done with the company that manages your DNS.

Allow around 3 hours for changes to your zone file to propagate across the internet.

In some cases, a CNAME or A record alone will be enough for your subdomain to start working as expected. Most of the time, however, you need to take additional steps with the hosting provider managing the website you're trying to point to. See Configuring your domain for specific services for some tutorials.

See also

1) …Technically, this is done for you automatically when you add a virtual host to your instance, but humor us.