How Can We Help You?

Just enter what you are looking for and we will point you in the right direction

DNS for Web Developers

Basic Stuff Everyone Should Know

We are going to take a look at how the Domain Name System can be used to help you keep your website online, improve website load times, email delivery, and so much more.

Before we get started, here’s a quick refresher on what DNS is and how it works.

We will be using Constellix to demonstrate how to create the various records you need to get your site online. You can follow along, just create a Constellix account and add a test domain.

Update Nameservers

Your first encounter with DNS almost always happens at your domain registrar –where you bought your domain name.

Ok so you have a domain name, cool, but it doesn’t actually do anything yet. If you type your brand spanking new domain into your browser, I bet you’ll see a placeholder page courtesy of your registrar.

Placeholder page for a domain with no website

Placeholder page for a new domain without a website.

First things first, get off your registrar’s DNS. There are many reasons why, and you can read more about those here.

You will need to change your domain’s nameservers to those of a specialized DNS provider (psst! Try Constellix!).

How you do it depends on your current provider, but basically what you want to do is make note of all of your existing DNS records. There may also be an option to export them into a zip file. Though, it’s likely won’t have any records unless you bundled with web hosting or another service. If you do, you’ll want to create the exact same records at your new provider.

Now you can add your domain to your new provider. You’ll be prompted to update your nameservers through your registrar. This tells the company you bought your domain from that you are going to be using another provider for DNS hosting. You may need to wait a few minutes, but if you have Constellix this takes only a few seconds thanks to our instant propagation.

One thing to note, changing DNS providers DOES NOT change who your registrar is. Your domain is still registered through your registrar, but you are now hosting your DNS information (records) through a different provider.

Now that you have moved to an external provider, you can start adding records. Let’s assume you don’t have any yet. You will need a handful to get your site up and running, which only takes a few minutes.

Get Naked

Before we go any further, you need to decide whether you want to send your users to www.yourdomain.com or yourdomain.com. The latter is called a “naked domain” or “CNAME flattening” and it’s the latest craze because frankly, it just makes life simpler.

We’re going to assume you, like the rest of the world, prefer to not type in the extra 4 characters of www.

But what if someone enters www.yourdomain.com into their browser? Where will they go?

Nowhere. Because we have to tell them that www is not the preferred version of our site. We can do this using a CNAME record.

CNAME Records

CNAME records point domains (or hostnames) to other domains (or hostnames). They are also called Alias records because they tell the user that the record information is actually hosted somewhere else.

You can even use CNAME records to point to external domains like www.yourdomain.com to www.google.com. Just remember to add a dot at the end, or the hostname will be appended to the beginning of your domain like www.google.com.yourdomain.com.

Keep in mind that CNAME records are different from Web Redirection because you can only point domains to other domains, no fancy URL paths. You wouldn’t be able to say www.yourdomain.com points to www.google.com/this-is-not-a-page.html.

Another thing to note, CNAME records cannot be used at the root level. So once we make our domain naked, we won’t be able to use a CNAME record to point your domain to another hostname… more on this in a few minutes.

For this use case, we need to point www.yourdomain.com to yourdomain.com. That means we are telling the user that the IP address for www.yourdomain.com is actually stored at yourdomain.com.

Now we need to create a CNAME record that tells everyone who types in www.yourdomain.com to go to yourdomain.com.

For the record name enter www and point that to the host: yourdomain.com. Make sure you do not add a period/dot/stop at the end. You only want to use those if you are pointing to an external domain like google.com.

How to create a CNAME record to a naked domain

Once you commit your changes, your domain will be naked! Go ahead and try it. Constellix propagates changes instantly to all of our nameservers around the world. That means your users in Australia can see the changes you made in under a second after you commit them.

Add a Web Server

Ok, we’re live on our new DNS provider and our domain is naked… but you don’t have a website. It just shows a blank page.

You need to create a record that tells your users how to get to the web server where you are hosting the files for your website. Let’s assume you already have a web server and at least a homepage (index.html) setup. Your web hosting provider will give you an IP address or hostname for the server your site is hosted on.

You need to tell users who visit your domain that they need to actually be going to the web server to see your website files. You can do that with an A record which answers users with the IP address of the web server or an ANAME (read more about this later) record that points to the hostname of the server.

In this example, we are going to use Constellix to show you how to create an A record. Leave the name field blank, since we want this to work at the root (naked) level of our domain. In the IP field, enter the IP address of your web server.

 

How to add an A record in Constellix

Your changes will propagate instantly. Now, when you type your domain name into your browser you will see the index.html page you have stored on your web server. All thanks to DNS.

More CNAME

Simplify Your Life

The next thing you need to do is setup your FTP (how you upload website files) and mail servers. Both of these services will most likely need to point to your web server. There are two ways to do this. You can take the hard way and go and make more A or CNAME records that point mail.yourdomain.com and ftp.yourdomain.com to your web server.

Or, you can create CNAME records that point to the root of our domain, which already has an A record that points to our web server.

How a CNAME to an A record works

That means, if you ever change your web server, all you have to do is update a single A record.

Gooooooogle

Have you ever accidentally added an extra “o” to google.com? It’s okay, we all have. But did you notice that you still ended up at google.com? Not gooogle.com or a blank page, but plain old google.com. That’s because Google uses a CNAME record to send traffic that mistakenly adds an extra “o” to their intended destination.

When you set up your own site, you may want to do the same thing. This does mean that you have to buy domains that are similar or a letter off from your own domain. Then, all you have to do is create a CNAME record that points users to the correct domain.