Cobra Developers
Blog, Infrastructure

How to point a domain to a new website: DNS explained

The short answer

To point a domain to a new website, log in to wherever your DNS is managed, add the domain in your new hosting account, then replace the old A record for the root domain and the CNAME record for www with the values your new host gives you. Leave email records alone. The change spreads as old cached answers expire.

Every site we launch ends the same way. The new site is finished and sitting on a temporary address, and one small change in a DNS control panel makes it the real one. For client rebuilds such as Vortech AC and Electrical, that change is the moment the old template site is replaced.

It is a five minute job that causes a surprising amount of anxiety, mostly because the vocabulary is strange and a mistake can take email down with the website. The second most common problem is not technical at all: nobody can find the login.

This post explains the handful of terms you need and the order to do things in.

What is DNS and what does pointing a domain mean?

DNS, the Domain Name System, is the internet's address book. It translates a name such as example.com into the numeric address of the server that holds the website. Pointing a domain means editing those address book entries so the name leads to your new host instead of the old one.

Three separate things are involved, and they are often held by three separate companies:

  • The registrar is where the domain name is registered and renewed.
  • The DNS provider holds the records for the domain. Often this is the registrar, but not always.
  • The web host is where the website's files or application live.

Moving a website changes only the third. You do not need to transfer the domain to a new registrar to launch a new site. You only need to change which host the records point to.

What is the difference between an A record and a CNAME record?

An A record points a name at a numeric IP address. A CNAME record points a name at another name, and lets that other name decide the address. Websites typically use an A record for the root domain, such as example.com, and a CNAME record for www.

Here are the record types you will meet:

RecordWhat it doesTypical use
APoints a name to an IPv4 addressThe root domain, example.com
AAAAPoints a name to an IPv6 addressSame as A, for IPv6
CNAMEPoints a name to another namewww.example.com
MXSays which servers receive emailYour email provider
TXTHolds text for verification and email authenticationProving ownership, SPF, DKIM
NSNames the servers that hold the domain's recordsSet at the registrar

One rule catches people out. Under standard DNS, the root domain cannot be a CNAME, because it has to carry other records such as MX. That is why hosts give you an IP address for the root and a name for www. Some DNS providers offer their own record type that works around this. If yours does, your host's instructions will say when to use it.

What are nameservers and when should you change them?

Nameservers are the servers that hold all the DNS records for your domain. Changing nameservers hands control of every record, including email, to a different DNS provider. You only need to change them if you want to manage DNS somewhere new. To launch a website, editing individual records is usually enough.

This is the choice that causes most accidents. A new host may suggest switching nameservers to them because it makes their setup simpler. That works, but the new provider starts with an empty or partial set of records. If your MX and TXT records are not copied over first, email stops arriving.

Our preference is to leave nameservers where they are and change only the web records. If there is a good reason to move DNS, copy every existing record to the new provider and compare the two lists before switching.

How do you point a domain to a new website step by step?

To point a domain to a new website, you confirm access, record the current settings, add the domain at the new host, lower the TTL, change the web records, and then verify. Done in that order, the switch involves no downtime and can be undone in minutes.

  1. Find out where DNS is managed and log in. Look up the domain's nameservers if you are unsure. Confirm you have a working login before launch day.
  2. Save the current records. Take a screenshot or export of every record. This is your undo button.
  3. Add the domain in the new hosting account. The host will show the exact records it wants, usually an A record for the root and a CNAME for www.
  4. Lower the TTL a day ahead. Set the TTL on the records you are about to change to a short value, so the eventual change spreads quickly.
  5. Change the web records only. Replace the old A record and the www CNAME with the new values. Do not touch MX records or email-related TXT records.
  6. Wait for the certificate. Most modern hosts issue an HTTPS certificate automatically once the domain points to them.
  7. Check both versions. Load the root domain and www, with HTTPS. One should redirect to the other.
  8. Raise the TTL again once everything is confirmed.
  9. Keep the old hosting for a few days. Visitors with a cached answer will still reach it until that answer expires.

We build and check a new site on a temporary address first, so the DNS change is the only thing happening on launch day. That approach is covered in staging vs production, and the follow-up tasks are in what happens after a website launches.

Why do I still see the old website after changing DNS?

You still see the old website because DNS answers are cached. Your internet provider, your router, your computer, and your browser each remember the old address for as long as the record's TTL allowed. Until those copies expire, your devices keep going to the old server even though the record has changed.

TTL stands for time to live. It is a number of seconds attached to each record that tells everyone how long they may remember the answer. A long TTL means fewer lookups and slower changes. A short TTL means the reverse. That is the reason for step 4.

This is also why the person who made the change is often the last to see it. You visited the old site recently, so your devices have a fresh cached copy. A customer who has never visited gets the new address immediately. To check the real state, test from a phone on mobile data, or use a DNS lookup tool that queries from several locations.

Who should hold the logins for your domain?

The business owner should hold the registrar account, in the business's own name and email address, with the renewal on a card that will not expire unnoticed. Developers and agencies can be given access. They should never be the only ones who have it.

On the Charme and Sons rebuild, nobody had the original site's source code, so we rebuilt it from the outside in. Code can be rebuilt. A domain cannot: if no one can log in to the registrar, there is no way to point the name anywhere. We wrote more about this in who owns your website.

Frequently asked questions

How long does a DNS change take?

It takes as long as the old cached answers last, which is governed by the TTL on the old record. With a short TTL set in advance, most visitors see the change quickly. With a long one, some will see the old site for a day or more.

Will changing DNS break my email?

Not if you leave the MX records and email-related TXT records alone, and do not switch nameservers without copying them. Email breaks when those records are deleted or left behind, not when a website record changes.

Do I need to transfer my domain to my web host?

No. A domain can stay registered wherever it is and still point to any host. Transferring is optional, and keeping the domain separate from hosting makes it easier to change hosts later.

Should the site use www or not?

Either works, and visitors rarely notice. Pick one as the main address, redirect the other to it, and use that same version in your links, your sitemap, and your business listings so search engines see one site.

If you have a new site ready and the launch step is the part making you nervous, we can handle it with you. Get in touch.

Who wrote this

The Cobra Developers team. We are a software studio in Arizona that builds and runs its own products and builds websites, web apps, and automation for clients. This post draws on our work on Vortech AC and Electrical, Charme and Sons. Everything here comes from projects we shipped; see all 30 of them.

guest@cobra: ~