How to Connect a Domain Name to Your Website (Step by Step)
This article contains an affiliate link. If you buy through it, I may earn a small commission at no extra cost to you.
You bought a domain name and you have a website, but typing your new address shows nothing, or the wrong page. This guide explains what is missing and how to connect the two, one clear step at a time.
What does "connecting a domain" mean?
Think of it like a house. Your website is the house, your hosting is the land it stands on, and your domain is the street address. Buying an address does not move the house: you must tell the world where the house is. That information is stored in DNS, which works like a phone book for the internet. Connecting your domain means writing the right entry in that phone book.
Before you start
- You own a domain (if not, read how to choose and buy a domain name).
- Your website is already online at a free address from your host, such as
yourproject.example.dev. If not, read how to build a website for free. - You can log in to the account where you bought the domain (the registrar) and to your hosting account.
- You have about 20 minutes, and some patience for the waiting time at the end.
Step 1: Choose your method
There are two ways to connect a domain. Your host usually tells you which one to use, so look in its help pages first.
| Method A: change the nameservers | Method B: add DNS records | |
|---|---|---|
| What you do | Tell your registrar to use your host's DNS servers | Keep the registrar's DNS and add a few lines to it |
| Where DNS is managed | At your host | At your registrar |
| Best for | Hosts that give you two nameserver addresses | Hosts that give you an IP address or a target name |
| Difficulty | Easy | Medium |
Method A: change the nameservers
This is the method I used. My host gave me two nameserver addresses, and I entered them at Namecheap, where I bought my domain. The screens look similar at other registrars, but the names of the menus may differ.
- Copy the nameservers from your host. They look like two addresses, each ending with the host's name. Write them down exactly, because one wrong letter breaks everything.
- Log in to your registrar and open your list of domains.
- Open the settings of your domain. At Namecheap, click Manage next to the domain.
- Find the "Nameservers" setting. It is usually a drop-down menu showing the registrar's default DNS.
- Choose "Custom DNS". Two empty boxes appear.
- Paste the two addresses from your host, one per box. Make sure there is no space before or after each one, and delete any old address left in the boxes.
- Save. At Namecheap, click the green check mark next to the boxes.
- Go back to your host and ask it to check the nameservers. Some hosts have a button for this and send an email when the domain is active.
Method B: add DNS records
Use this method if your host asks you to add records instead of changing nameservers.
- At your registrar, open the settings of your domain and find the page for DNS records. At Namecheap, it is the Advanced DNS tab.
- Delete the parking records. A newly bought domain often points to a "parked" page of the registrar. Remove the old records of type A and CNAME that point to it, or your site will not appear.
- Add the records your host gives you. They usually look like this:
| Type | Host | Value | What it does |
|---|---|---|---|
| A | @ | the IP address your host gives you | Connects yourdomain.com |
| CNAME | www | the target name your host gives you | Connects www.yourdomain.com |
The symbol @ means "the main domain with nothing in front of it". Copy the values from your host, not from this page, because they differ from one host to another.
Step 3: Tell your host about the domain
Many hosts also need you to add the domain on their side. Look for a section called Domains or Custom domain in your project, type your domain, and also add the www version. This is the step that makes the host serve your site when someone types your address.
Step 4: Wait, then test
After the change, the information spreads across the internet. This can take from a few minutes up to 24 hours. You cannot speed it up, so do not change settings again and again, because that can make the wait longer.
- Open a private browser window and type your domain.
- Test
yourdomain.comandwww.yourdomain.com. - Check that the address begins with
httpsand that the browser does not show a security warning.
Fix the most common problems
| What you see | Likely cause | What to do |
|---|---|---|
| The registrar's "parked" page | Old parking records still exist | Delete the old A and CNAME records, or check that Custom DNS is saved |
| "Site cannot be reached" | The change has not spread yet, or a value is wrong | Wait a few hours, then compare every value letter by letter |
| "Not secure" warning | The security certificate is not ready yet | Wait 15 to 60 minutes and refresh |
Main domain works, www does not | The www record or host setting is missing | Add the www version at your registrar and at your host |
| Your old page appears | Your browser kept an old copy | Press Ctrl + F5 or use a private window |
If you also use email on your domain
If you already created email addresses such as contact@yourdomain.com, do not delete the MX and TXT records. They control your email. Only remove the parking records for the website.
Final checklist
- The domain is connected, by nameservers or by records, but not both at the same time
- The domain is also added at your host, with and without
www - Your site opens on
httpswithout a warning - You wrote down where you bought the domain and when it expires
Final thoughts
Connecting a domain feels technical the first time, but it is only two things: tell the registrar where your DNS is, and tell your host which domain to serve. Take it slowly, copy each value carefully, and give it time. Next, you can build a free email list to keep in touch with your first visitors.