Buying a domain and purchasing hosting are only the first steps toward launching a website.
You also need to connect the domain to the server where your website is hosted.
This process is usually handled through DNS.
For beginners, DNS can sound complicated, but the basic idea is simple:
Your domain needs to know where your website is hosted.
This guide explains how to connect a domain to hosting using nameservers or DNS records.
Domain and Hosting Are Separate
Suppose you have:
Domain:example.com
Hosting:
A server with your hosting provider
The two services do not automatically know about each other if they were purchased separately.
You need to configure DNS.
Two Common Ways to Connect a Domain
There are two common approaches:
Method 1: Change Nameservers
You point the domain to the hosting provider’s nameservers.
Method 2: Change DNS Records
You keep your current DNS provider and point records such as A or CNAME toward the hosting environment.
Which method is appropriate depends on your hosting and DNS setup.
Method 1: Connect Using Nameservers
Your hosting company may provide nameservers such as:
ns1.examplehost.com
ns2.examplehost.com
The exact nameservers vary by provider.
Step 1: Buy hosting
Purchase a hosting plan suitable for your website.
Step 2: Find the nameservers
Log into your hosting dashboard.
Look for:
- DNS
- Nameservers
- Domain connection
- DNS information
Step 3: Log into your domain registrar
Open the domain management dashboard.
Step 4: Find nameserver settings
Look for:
Nameservers
or
DNS / Nameserver Management
Step 5: Replace the existing nameservers
Enter the nameservers supplied by your hosting provider.
Step 6: Save
Save the changes.
DNS changes may take time to become visible across different DNS resolvers.
Important Warning Before Changing Nameservers
Changing nameservers changes which DNS provider is authoritative for your domain.
If your existing DNS records are not recreated at the new DNS provider, services can stop working.
For example, you may have DNS records for:
- Website
- Subdomains
- Verification services
- Other applications
Cloudflare specifically warns users to review DNS records before changing nameservers because missing records can make a domain unreachable.
This is particularly important when your domain already has a working business email.
Method 2: Connect Using an A Record
An A record maps a hostname to an IPv4 address.
For example:
example.com → 203.0.113.10
The IP address above is only an example.
Your hosting provider should give you the actual IP address.
Cloudflare’s DNS documentation describes A records as records that map a domain to an IPv4 address.
What Is a CNAME Record?
A CNAME record points one hostname toward another hostname.
For example:
www.example.com
may point toward another hostname supplied by a hosting or platform provider.
CNAME records are commonly used for subdomains and service integrations.
What Is an MX Record?
MX means Mail Exchange.
MX records tell email systems where email for your domain should be delivered.
For example:
you@example.com
requires appropriate mail DNS configuration.
This is why changing DNS without checking existing email records can cause email problems.
What Is a TXT Record?
TXT records store text information associated with a domain.
They are commonly used for:
- Domain verification
- SPF
- DKIM-related configuration
- DMARC
- Other service verification
Do not delete TXT records simply because you don’t recognize them.
They may be required by an existing service.
What Is TTL?
TTL means Time to Live.
It determines how long DNS information may be cached by DNS resolvers.
Cloudflare documents TTL as controlling how long DNS records are cached by DNS resolvers.
A change may therefore not appear everywhere immediately.
How Long Does DNS Propagation Take?
People commonly say “DNS propagation” when discussing DNS changes appearing across different networks.
The actual behavior depends on DNS caching and TTL settings.
You may see the new configuration from one network while another still returns the older information.
Therefore, don’t assume that a DNS change is broken simply because it isn’t visible everywhere immediately.
How to Check Your DNS
You can use DNS lookup tools to inspect records.
Check:
- A
- AAAA
- CNAME
- MX
- NS
- TXT
Compare the results with the configuration supplied by your hosting or DNS provider.
How to Connect Domain to WordPress Hosting
The basic process is:
- Register your domain
- Purchase WordPress hosting
- Install WordPress
- Find your hosting DNS information
- Configure nameservers or DNS records
- Wait for DNS changes to become visible
- Enable HTTPS
- Open the website
- Confirm WordPress URLs
- Test the website
WordPress currently recommends HTTPS as part of the hosting environment.
What Happens After DNS Is Connected?
Once DNS correctly points visitors toward the hosting environment:
Visitor
↓
Domain
↓
DNS
↓
Hosting Server
↓
Website
↓
Browser
This is a simplified representation of the process.
How to Connect www and Non-www
You may have:
example.com
and:
www.example.com
Your DNS configuration should account for both if you intend to support both versions.
The website should normally establish a consistent preferred URL and redirect the alternate version appropriately.
For example:
www.example.com → example.com
or the reverse.
The important thing is consistency.
SSL After Connecting the Domain
After connecting the domain, configure HTTPS.
Your website should load through:
https://example.com
rather than only:
http://example.com
Check:
- SSL certificate
- HTTPS loading
- HTTP → HTTPS redirect
- Mixed-content issues
- www/non-www consistency
Common DNS Problems
Website not opening
Possible causes:
- Incorrect A record
- Incorrect nameservers
- Wrong IP address
- DNS changes not visible yet
- Hosting account not configured
Website works but email stopped
Possible causes:
- Missing MX records
- Incorrect mail records
- Nameserver migration without copying existing DNS records
www doesn’t work
Check the CNAME or relevant DNS configuration for the www hostname.
SSL error
Possible causes include:
- Certificate not issued
- Incorrect DNS
- Incorrect HTTPS configuration
- CDN/proxy configuration problems
- Certificate mismatch
Cloudflare and DNS
Cloudflare can act as a DNS provider and, depending on configuration, as a reverse proxy/CDN and security layer.
When using Cloudflare’s full DNS setup, you generally add the domain, review/import records and update the domain’s nameservers to Cloudflare’s authoritative nameservers.
Always verify DNS records before making the nameserver change.
Domain Connection Checklist
Before declaring the migration complete, check:
Domain
- Domain active
- Correct nameservers
- Correct registrar account
DNS
- A record
- CNAME
- MX
- TXT
- Other required records
Website
- Homepage works
- Internal pages work
- Images load
- Forms work
HTTPS
- SSL active
- HTTPS works
- Redirect works
- Incoming email works
- Outgoing email works
Search engines
- Preferred URL configured
- Sitemap available
- Search Console property verified

Add comment