Connect a domain to a website
To connect a domain to a website, you tell DNS where the website is hosted. There are two ways to do it: hand the domain's whole DNS to your host by changing its nameservers, or keep your DNS where it is and add the records your host asks for.
Choose a method
| Change nameservers | Add DNS records | |
|---|---|---|
| What moves | All DNS for the domain | Only the records you change |
| Who manages your records afterwards | The new DNS provider | Your current DNS provider |
| Best when | Website and email are with the same provider | Website and email are with different providers |
| Main risk | Email stops if its records are not recreated | Missing www or an outdated record |
If you are not sure, adding records is the smaller change: everything you do not touch keeps working.
Method 1: add DNS records
Most hosts give you an IP address for the domain itself and ask you to point www at the same site.
- Open the DNS editor for your domain at the provider that runs your current nameservers.
- Find any existing A and AAAA records for the domain itself (shown as
@or left empty) and forwww. Edit them rather than adding duplicates. - Set the A record for
@to the IPv4 address your host gave you, for example203.0.113.10. Add an AAAA record only if your host gave you an IPv6 address. - For
www, add a CNAME record pointing toexample.com(or to the target name your host gave you). If awwwA record already exists, update or remove it first, because a name with a CNAME cannot have other records. - Save, then wait at least as long as the old records' TTL before testing.
The result looks like this:
example.com. 3600 IN A 203.0.113.10
www.example.com. 3600 IN CNAME example.com.
Leave your MX and email TXT records as they are. They control email, not the website.
Method 2: change the nameservers
- Before you switch, recreate every record you still need at the new DNS provider, especially MX, TXT and any records for subdomains. The new provider starts with only what you add.
- Sign in where the domain is registered and find its nameserver settings.
- Replace the existing nameservers with the ones your new provider gave you, exactly as written. Most domains need at least two.
- Save. The registry usually accepts the change quickly, but networks may keep using the old nameservers for up to a day or two.
Once the nameservers change, the records at your old DNS provider stop being used. If your email records were not recreated at the new provider first, incoming email can bounce until they are added.
Check that it works
Once you have waited for the TTL to pass, check what DNS returns for your domain. On Windows, open Command Prompt or PowerShell:
nslookup example.com
nslookup www.example.com
On macOS or Linux, open Terminal:
dig +short example.com A
dig +short www.example.com
dig +short example.com NS
The addresses should match the ones your host gave you. If they do, open the site in a private browser window. If it still shows the old site or an error, see Why DNS changes take time and A website that won't load.
For the steps inside your DomainPilot account, see Manage a domain in your account. DNS management is included with every domain registered with DomainPilot.