Business tech · Beginner · 15 min
How to Point a Domain Name at Your Website
By Padding · Updated 16 Nov 2026
Any registrar and host
You will connect a domain you own to a website on any host by adding the right A, AAAA and CNAME records at your DNS provider, test the site before DNS changes, and check with dig that the change has reached the world.
On this page
You bought a domain, such as example.com, and you have a website on a server. Nothing connects them yet. A visitor who types the domain into a browser first asks the Domain Name System (DNS) where the site lives, and DNS answers with an IP address. Pointing your domain at your website means putting that answer in the right place: a few DNS records at the service that answers for your domain.
The steps are the same on every registrar and host. Only the buttons differ. This tutorial explains what to add, what to leave alone, how to test the website before you change anything public, and how to check that the change has spread. If you want the background on each record type first, read DNS records explained.
Step 1 · Find out who answers for your domain
Three companies are often involved, and they are not always the same one:
- The registrar is where you bought the domain and where you renew it.
- The DNS host runs the nameservers that answer questions about the domain. By default it is the registrar, but it can be Cloudflare, your web host or a cloud DNS service.
- The web host runs the server with your site.
The records go to the DNS host. To see which it is, ask for the domain's nameservers (the NS records):
dig +short NS example.comReplace example.com with your domain. You get a list of names such as elliott.ns.cloudflare.com. and hera.ns.cloudflare.com., which here means the DNS host is Cloudflare. Log in to that service, open the DNS settings for your domain, and make the changes there. If you edit records at the registrar while the nameservers point at another provider, nothing changes, because nobody asks the registrar's DNS. This is the most common reason that "I added the record and nothing happened".
If you have never used dig, it is installed on macOS, and on Ubuntu the package is dnsutils (sudo apt install dnsutils). On Windows, a free web tool that shows DNS records works for these checks.
Step 2 · Get the address from your web host
Your host shows the server's IPv4 address, four numbers such as 203.0.113.10, in its dashboard. Some also give an IPv6 address, which is longer, such as 2001:db8::10. Write them down. If the host gave you a hostname instead of an address, which is typical for managed platforms, you will use a CNAME record instead of an A record. In these examples 203.0.113.10 is a documentation address, so replace it with your own.
Check that the site works at that address before DNS is involved. This is the safest test and it changes nothing for anyone. --resolve tells curl to use your address for the name, as if DNS had already been changed:
curl -sI --resolve example.com:80:203.0.113.10 http://example.com/A good answer starts with HTTP/1.1 200 OK, or with 301 if the site redirects to HTTPS. If you get 404 or the host's default page, the server does not know the name example.com yet. Fix that on the server first, for example with a server block as in host multiple sites with Nginx, or add the domain in your host's dashboard. If the connection times out, the firewall blocks port 80.
Step 3 · Look at what is already there
Open the DNS records for the domain. Before you add anything, read what exists:
- A parking page record: registrars often create an
Arecord at the root name that points at their own "this domain is parked" page. It must go, or be replaced by yours. TwoArecords at the same name send some visitors to each address. MXrecords send your email. Do not touch them. Deleting them stops your email.TXTrecords prove ownership to Google, Microsoft and others, and protect your email (SPF, DKIM, DMARC). Keep them.CNAMErecords for other services, such as ashopname pointing at a store platform. Leave them.
Take a screenshot or copy the list now, so you can put it back if something goes wrong.
Step 4 · Add the records
You usually need two names: the bare domain (example.com, called the root or apex, written @ in most dashboards) and www. Add these:
| Type | Name | Value | What it does |
|---|---|---|---|
| A | @ | 203.0.113.10 | Sends example.com to your server's IPv4 address |
| AAAA | @ | 2001:db8::10 | The same for IPv6; add it only if the server really answers on IPv6 |
| CNAME | www | example.com. | Makes www.example.com follow whatever example.com points at |
Notes on filling in the form, because every provider is a little different:
@means the domain itself. Some dashboards want the name left blank instead.- Some dashboards add your domain to the name for you. Typing
www.example.comin the name field may then createwww.example.com.example.com. Typewwwonly. Others need a trailing dot on the value,example.com., which marks it as a complete name. Look at the example the form shows. - A
CNAMEcannot sit at the root. The DNS rules say that a name with aCNAMEcan have no other record, and the root always has others (NS,SOAand usuallyMX). If your host gave you a hostname for the root, look for a record type calledALIAS,ANAMEor "CNAME flattening" at your DNS provider; they answer with an address and still follow the hostname. That is a provider feature, not part of the DNS standard. - Skip
AAAAunless you are sure. A wrong IPv6 address makes the site fail for visitors whose connection prefers IPv6, and the failure is hard to spot from your own computer. - The
TTL(time to live) is how long, in seconds, other computers may remember an answer.3600(one hour) is a sensible default for a site you are launching. Lower values spread changes faster and cost slightly more DNS lookups.
Save the records.
Step 5 · Check that it worked
Ask for the records. Ask the DNS host's own nameserver first, the one you found in the first step. This is the source of truth, and it answers at once, with no caching in the way:
dig +short @elliott.ns.cloudflare.com example.com A
dig +short @elliott.ns.cloudflare.com www.example.com CNAMEReplace the nameserver with one of yours. You should get your address, and example.com. for the second. Now ask a public resolver, as a visitor's computer would. Replace 1.1.1.1 with 8.8.8.8 to try another:
dig +short @1.1.1.1 example.com A
dig +short @1.1.1.1 www.example.com AThe second command shows the CNAME target first and then the address, for example example.com. followed by 203.0.113.10. A site that uses this layout in real life is www.github.com, which answers with a CNAME to github.com., whose A records hold the address. If the authoritative answer is right and the public one is old, wait. That is caching, covered next.
Then test the actual website, now using real DNS and no tricks:
curl -sI http://example.com/ | head -n 1
curl -sI http://www.example.com/ | head -n 1Both should start with HTTP/1.1 200 OK or 301.
Why it is not instant
Resolvers around the world keep answers for the TTL, so someone who looked your domain up before the change keeps the old answer until it expires. If the old value had a TTL of one hour, most visitors see the new site within an hour. A name that did not exist when someone asked can also be remembered as "does not exist" for a while (this is called negative caching, from the zone's SOA record), so check a brand-new name once rather than refreshing for an hour. If you moved your DNS to a new provider by changing nameservers at the registrar, the registry's delegation answer is kept by resolvers for up to two days (172800 seconds for .com), so expect to wait longer in that case.
Your own computer also keeps answers. If dig shows the right address and the browser does not, clear the local cache. On macOS:
sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponderOn Ubuntu and other systemd systems:
resolvectl flush-cachesOn Windows, ipconfig /flushdns. Then close the browser fully and reopen it, because browsers cache too.
Troubleshooting
status: NXDOMAINindigoutput: the name has no records. Check for typos and for a doubled domain such aswww.example.com.example.com.- The authoritative server gives the right answer, but public ones give a different one for hours: normal caching. Wait for the old TTL.
digshows your records but the browser shows the host's default page: the server does not serve your domain yet. Repeat thecurl --resolvetest and fix the server.wwwworks and the root does not, or the reverse: one of the two records is missing, or a parkingArecord is still there.SERVFAILafter you changed DNS providers: a leftover DNSSEC setting. If the registrar has aDSrecord for the old provider, remove it, or enable DNSSEC at the new one and publish the newDS. Ask your DNS host.- A certificate warning in the browser: the site needs a certificate for the domain. Get one only after DNS points at the server: free HTTPS with Let's Encrypt and Nginx.
Step 6 · Make the www and root names agree
Visitors will type either name, and search engines treat them as different sites unless you pick one. Decide which is the main one, and make the other redirect to it with a 301. In Nginx, a separate server block with return 301 https://example.com$request_uri; for the www name does it. Do this after HTTPS works for both names.
Next steps
- Get a certificate for the domain: free HTTPS with Let's Encrypt and Nginx.
- Set up email records so your mail is not marked as spam: set up SPF, DKIM and DMARC.
- Understand the other record types: DNS records explained.
- Moving to another host later: move a website to a new host without downtime.
Related tutorials
- DNS Records Explained: A, AAAA, CNAME, MX and TXT, with dig ExamplesYou will learn what the common DNS record types do and read each one with dig, using a small practice DNS server you start yourself.
- How to Get Free HTTPS for Your Site with Let's Encrypt and NginxYou will install Certbot 5.10, get a free Let's Encrypt certificate for your domain, have Nginx serve it over HTTPS, and confirm that it renews on its own.
- How to Host Multiple Websites on One Server with NginxYou will run two separate websites on one Ubuntu 26.04 server by giving each its own Nginx server block, decide what unknown names receive, and check every site before DNS points at it.
Need this done for you?
Padding does this work for growing companies, from the first diagnosis to a system that keeps working.
Get new tutorials