Connecting a domain to a website means editing DNS records. This step-by-step guide explains nameservers, A records and CNAMEs, and how to avoid the mistakes that take sites offline.
You have bought a domain name and you have a website hosted somewhere. Connecting the two is done through the Domain Name System (DNS), the internet's address book, which translates a name like example.com into the address of the server that hosts the site. The steps are simple once you know which settings to change.
Two ways to connect a domain
Option 1: Change the nameservers
Nameservers decide who manages your domain's DNS records. Your web host or DNS provider gives you two or more nameserver addresses. You enter them at your domain registrar, the company where you bought the domain. From then on, all DNS records are managed at the new provider.
Use this when your host recommends it and you want everything in one place.
Option 2: Keep the nameservers and edit DNS records
Leave DNS at your registrar or current DNS provider and add the specific records your host gives you.
Use this when you have other services on the domain, such as business email, that you do not want to disrupt.
Important: if you change nameservers, any existing records, including those for email, must be recreated at the new provider, or those services will stop working.
The records you need to know
| Record | What it does | Example |
|---|---|---|
| A | Points a name to an IPv4 address | example.com to 203.0.113.10 |
| AAAA | Points a name to an IPv6 address | example.com to 2001:db8::10 |
| CNAME | Points a name to another name | www to example.com |
| MX | Directs email for the domain | Your email provider's servers |
| TXT | Holds text for verification and email security | SPF, site verification codes |
Step by step: editing records
- Get the target details from your host: usually an IP address for an A record, or a hostname for a CNAME.
- Log in to your DNS provider and open the DNS management page for the domain.
- Set the root domain (often shown as
@): edit or create the A record so it points to your host's IP address. Remove old A records for@that point elsewhere. - Set the www subdomain: create a CNAME for
wwwpointing to your root domain or to the hostname your host provides. - Leave MX and TXT records alone unless you are changing email providers.
- Save and wait for the change to take effect.
www or no www?
Choose one version as your main address and redirect the other to it, so visitors and search engines always end up at a single URL. Most hosts let you set this in their dashboard. Consistency matters more than which you choose.
How long does it take?
DNS changes are cached around the internet for the period set by each record's TTL (time to live). Many changes appear within minutes to a few hours; nameserver changes can take up to a day or two to be seen everywhere. Lowering the TTL a day before a planned change can speed things up.
To check progress, use an online DNS lookup tool that queries servers in several locations, or run nslookup example.com from a command prompt.
Secure it with HTTPS
Once the domain points to your site, enable an SSL/TLS certificate so the site loads over HTTPS. Many hosts do this automatically using free certificates from Let's Encrypt. Then redirect all HTTP traffic to HTTPS.
Common mistakes
- Changing nameservers and forgetting to recreate email records
- Leaving an old A record in place alongside the new one
- Creating a CNAME on the root domain where your provider does not support it
- Letting the domain expire; switch on auto-renew and keep your registrar contact email current
Sending email from your domain? Set up authentication next; see SPF, DKIM and DMARC explained. Then make your new site fast with our guide to compressing images for the web.











0 Comments
No comments yet — be the first to share what you think.