Coffee and Code

How web domains work

I’ve been freelancing as a web programmer for more than 6 years now, but (surprisingly) I’ve never known the intricacies behind how web domain names worked until today (I had to help a client resolve some issues regarding it). The understanding came to me in an epiphany only after I’ve read and pondered on many articles, Wikipedia pages and Stack Overflow pages over the past few days.

Because web domains can be an incredibly complex business, and all the online instructionals I’ve found are really long, I wrote this in such a way that it imparts a big picture view. Hopefully, it’ll help you figure things out faster than I did.

Let’s Start

To have a conventional website, you need to have (buy) 2 things:

  1. A domain name, e.g. example.com
  2. A web host, which is a computer that serves other computers that connect to it (hence, they are also called servers).

By default, web hosts are identified by an IP address—a series of 4 numbers (each between 0 to 255)—and they look like so: 123.45.67.89. This IP address needs to be linked to your domain name, so that when people type your domain name into their web browser, they will be connected to your web host instead.

Clear so far? Next comes the hard part.


Article continues after the advertisement:


Nameservers

When you register a domain name, you’re going to hit another snag when you try to point it to your web host’s IP address—they can only be configured to point to something called a nameserver, not your web host’s IP address. You need to configure the nameserver records to point your domain name to your web host.

The good news is that both domain name registrars and web host providers usually provide you with nameservers when you buy from them. The bad news is that nameserver records are a pain in the butt to learn; and if your setting up of a website is a one-and-done thing, you’re better served by buying your web host and domain name from someone that sells both—like GoDaddy, Namecheap or Siteground (they are welcome for the free advertising)—because they will add the necessary nameserver records for you.

For the rest of us, we are going to have to get familiar with how nameserver records work.

Purpose of Nameservers

Having a nameserver between the web host and domain name seemss like an extraneous step, but they serve a purpose: they help to route different kinds of requests to your domain name to different places—but what does this mean?

When you buy example.com, for example, you also own images.example.com, members.example.com, abc.def.example.com or any other prefix you want to add in front of example.com. You can point each of them to different IP addresses (i.e. web hosts), or you can configure them all to redirect to www.example.com, among other things.

You also own the email extension of @example.com by owning example.com, and nameservers are also responsible for routing email to the right web hosts (called mailservers) for handling email.

Conclusion

In short, to have a website, you need to have a domain name and a web host, and then you need to link them together through a nameserver which needs to be configured with nameserver records. But you don’t really have to go through all this if building a website is a one-and-done thing for you. Instead, use a service that provides both web hosting and domain names as a package, and they will handle all the intricacies for you.

Now, if you need more in-depth information, here’s a very verbose (but informative) article from HowStuffWorks.


Article continues after the advertisement:


Leave a Reply

Your email address will not be published. Required fields are marked *

Note: You can use Markdown to format your comments.

This site uses Akismet to reduce spam. Learn how your comment data is processed.