====== 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 ([[:en:domains:management:domain-as-website:forwarding|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 [[https://www.gandi.net/hosting/|Simple Hosting]] service, and publish it at ''%%http://www.example.com%%''. In this case, your site is hosted on the [[:en:dns:zone:www|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** ^ | www|example.com| | blog|example.com| | wiki|example.com| | photos|example.com| | anything|example.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: - that a subdomain exists, and - 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 ((//...Technically//, this is done for you automatically when you add a virtual host to your instance, but humor us.)): 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 [[:en:domains:management:wix|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|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|CNAME record]]. The changes to the zone file can only be done with the company that manages your DNS. * If you are using [[:en:domains:management:using-gandi-dns|Gandi's DNS]], you can see how to add your CNAME or A records in order to create your subdomain at the below pages: * [[a-record|How to add or change an A record]] * [[cname-record|How to add or change a CNAME record]] **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 [[:en:domains:management#configuring-your-domain-for-specific-services|Configuring your domain for specific services]] for some tutorials. ===== See also ===== * [[:en:dns:zone:www]]