Configuring Root Domains in Namecheap DNS: A Record vs CNAME

by Fahim Mahmud Chisti

To configure a root domain in Namecheap DNS, use an A record on host @ that points to your server’s IP address, or Namecheap’s ALIAS record when your host gives you a hostname instead of an IP. A CNAME on the root domain (example.com) breaks the DNS rules and stops your email. Below you will pick the right record, redirect www, and check the result with dig.

Quick answer: On the root domain (host @), use an A record when your host gives you an IP address and an ALIAS record when it gives you a hostname. Use CNAME records only on subdomains such as www.

  1. Choose an A record if you have a static IP (a VPS, GitHub Pages, most shared hosting).
  2. Choose an ALIAS record if the host only gives you a hostname (for example Heroku or CloudFront).
  3. Choose a URL Redirect on @ only if the root just has to send visitors to www over plain HTTP.
  4. Point www at your host with a CNAME, then redirect one name to the other.
In this guide
  1. Before You Start
  2. Why a CNAME Doesn’t Work on the Root Domain
  3. A Record vs CNAME: What Each One Does
  4. Step 1: Add an A Record for the Root Domain
  5. Step 1 (Alternative): Use ALIAS or URL Redirect When You Only Have a Hostname
  6. Step 2: Redirect www to the Root Domain (or the Reverse) Without Breaking SSL
  7. Step 3: Check the Records With dig and curl
  8. Common Root Domain Mistakes in Namecheap
  9. Frequently Asked Questions
  10. Next Steps
Terminal screen showing DNS dig resolution commands and A record routing for a root domain

Before You Start

  • Access: your Namecheap login, plus the IP address or hostname your host tells you to use for the root domain.
  • Nameservers: the domain must use Namecheap BasicDNS (or PremiumDNS or FreeDNS) for records in Advanced DNS to take effect. Check under Domain > Nameservers.
  • Note your current records: copy or screenshot every row in Advanced DNS first. Deleting the wrong row, or adding a CNAME on @, can stop email for the whole domain.
  • Time: a few minutes of work. Record changes usually show within 30 minutes, the length of Namecheap’s Automatic TTL.

Why a CNAME Doesn’t Work on the Root Domain

DNS seems simple enough until you try pointing a zone apex (the bare root domain like example.com) at another hostname with a CNAME. Namecheap’s own documentation tells you not to create a CNAME with host @, because it stops the domain’s MX records from working.

This isn’t a Namecheap limitation. It comes from the DNS standard itself, IETF RFC 1034 Section 3.6.2. The spec states that if a node has a CNAME record, it cannot hold any other resource records. The problem is that your root domain must have other records to function at all:

  • SOA (Start of Authority): Defines authoritative zone parameters.
  • NS (Name Server): Points to the nameservers authoritative for the zone.
  • MX (Mail Exchange): Directs incoming email to your mail provider.

A resolver that finds a CNAME at the root (@) follows it for every record type, so lookups for your MX and TXT records end up at the CNAME target instead. That kills incoming email and breaks TXT-based verification. If you need mail working on your domain, check out how to route custom domain email to Google Workspace with Namecheap DNS.

A Record vs CNAME: What Each One Does

To pick the right record, it helps to know how resolvers (the DNS servers that look names up for visitors) handle A records and CNAMEs.

An A Record maps a hostname straight to an IPv4 address (like 192.0.2.1), and an AAAA Record maps to an IPv6 address. When a client requests an A record, the nameserver returns the IP immediately in the first response. Done in one round-trip.

A CNAME Record maps an alias to another hostname (like myapp.onrender.com or cname.vercel-dns.com). The resolver receives the alias, realizes it still doesn’t have an IP, and fires off an extra DNS query to resolve that target hostname. That adds one more lookup on a cold cache, and it triggers the RFC exclusivity rule.

Here is which record to use on each host in Namecheap:

Host What your host gave you Record type in Namecheap Example value
@ (example.com) One or more IP addresses A Record (AAAA Record for IPv6) 198.51.100.42
@ A hostname only ALIAS Record example-1234.herokudns.com
@ Nothing; the root should just send visitors to www URL Redirect Record https://www.example.com
www, api, app A hostname CNAME Record your-target-hostname.net.
www, api, app An IP address A Record 198.51.100.44
* (wildcard) One endpoint for any subdomain A or CNAME Record Your server’s IP or hostname

Subdomain records never interfere with the records on the root. The one combination to avoid is a CNAME on @.

Step 1: Add an A Record for the Root Domain

If your hosting provider gives you a static or dedicated IP address (standard for VPS instances, dedicated boxes, and many static hosts), an A record on the root domain is the fastest, cleanest approach.

Head to your Namecheap Domain List, click Manage next to your domain, and open the Advanced DNS tab. Make sure your nameservers are set to Namecheap BasicDNS under the main Domain tab.

Under Host Records in Advanced DNS, delete any default parking records (such as default URL Redirects or parking pages) and add your entry:

  1. Click Add New Record.
  2. Set Type to A Record.
  3. Set Host to @ (which represents the naked apex domain).
  4. Set IP Address to your server’s public IPv4 address (e.g., 198.51.100.42).
  5. Set TTL to Automatic (or 1 min / 5 min if you are testing a migration).

If your provider uses multiple IP addresses for redundancy or load balancing (like GitHub Pages), create multiple A records with @ as the host, one for each IP.

You don’t type the following anywhere in Namecheap. It only shows how the finished records look in standard zone-file notation:

; Namecheap Zone File Output for Apex and Subdomain
@ 300 IN A 198.51.100.42
@ 300 IN A 198.51.100.43
www 300 IN CNAME example.com.
api 300 IN A 198.51.100.44

For modern static frontends and Jamstack platforms, follow our walkthroughs on pointing a Namecheap domain to Vercel and pointing a Namecheap domain to GitHub Pages.

Step 1 (Alternative): Use ALIAS or URL Redirect When You Only Have a Hostname

What if your host doesn’t offer static IPs? Platforms like Heroku, AWS Elastic Beanstalk, and CloudFront only hand you a hostname like d1234.cloudfront.net or example-1234.herokudns.com.

Namecheap BasicDNS, PremiumDNS, and FreeDNS give you two ways to handle that:

Option A: Use Namecheap’s ALIAS Record

An ALIAS record points the root at a hostname like a CNAME does, but it can coexist with the MX, TXT, and NS records on the root.

  1. Under Namecheap Advanced DNS, remove any A, AAAA, CNAME, or URL Redirect record on host @.
  2. Click Add New Record and select ALIAS Record.
  3. Set Host to @.
  4. Set Value to your target hostname (for example example-1234.herokudns.com).
  5. Keep the TTL at 5 min (ALIAS records only offer 1 min or 5 min).

To check it, run dig example.com A +short in a terminal. An ALIAS answers with the target’s current IP addresses rather than a hostname, so seeing one or more IPs means it works.

Option B: Use Namecheap’s URL Redirect Record

Let Namecheap run an HTTP 301 redirect from the root domain to your www subdomain, then point www to your target hostname using a CNAME.

  1. Under Namecheap Advanced DNS, click Add New Record.
  2. Select URL Redirect Record.
  3. Set Host to @.
  4. Set Value to https://www.example.com.
  5. Set the redirect type to Permanent (301).
  6. Add a second record: Type CNAME Record, Host www, Value your-target-hostname.net., TTL Automatic.

The catch: Namecheap’s redirect service typically answers plain HTTP only. A visitor who types https://example.com gets a certificate error or a timeout instead of the redirect, so prefer the ALIAS record whenever the bare domain has to work over HTTPS.

Step 2: Redirect www to the Root Domain (or the Reverse) Without Breaking SSL

Pick one main address, either example.com or www.example.com, and send the other one there with an HTTP 301 redirect. Search engines then see one site instead of two, and logins don’t split across two cookie domains.

If you run your own Nginx server, point both @ and www to your server IP with A records, then handle HTTPS and the 301 redirect inside Nginx.

On the server, save this config as /etc/nginx/sites-available/example.com.conf (the Debian/Ubuntu layout) and enable it. It redirects www to the root domain over HTTPS:

# /etc/nginx/sites-available/example.com.conf

# Redirect HTTP traffic to HTTPS Apex
server {
    listen 80;
    listen [::]:80;
    server_name example.com www.example.com;
    return 301 https://example.com$request_uri;
}

# Redirect HTTPS www to HTTPS Apex
server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name www.example.com;

    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;

    return 301 https://example.com$request_uri;
}

# Main application block
server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name example.com;

    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;

    root /var/www/example.com/public;
    index index.html index.php;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }
}

On Nginx 1.25.1 and newer, nginx -t warns that the http2 parameter on the listen line is deprecated. The config still works; to silence the warning, remove http2 from the listen lines and add http2 on; inside each 443 server block.

Make sure your SSL certificate covers both names by passing both -d flags to Certbot. Run it on the server over SSH, and issue the certificate before you enable the two 443 blocks, because Nginx refuses to load a config that references certificate files that do not exist yet:

sudo certbot certonly --nginx -d example.com -d www.example.com

Certbot should print Successfully received certificate and the path under /etc/letsencrypt/live/example.com/. Then enable the full config and run sudo nginx -t && sudo systemctl reload nginx; nginx -t should report that the configuration test is successful.

Step 3: Check the Records With dig and curl

Don’t rely on your browser to verify DNS changes. Browsers cache DNS lookups and remember HSTS redirects, which hides what the nameservers are actually returning.

Open a terminal on your computer and query your records with dig. Ask Namecheap’s authoritative nameserver directly first, then test public resolvers like Google (8.8.8.8) and Cloudflare (1.1.1.1). On Windows without dig, nslookup example.com dns1.registrar-servers.com shows the same A record.

To check an apex A record lookup:

# Query Namecheap authoritative nameservers directly
dig @dns1.registrar-servers.com example.com A +noall +answer

# Follow the delegation from the root servers down
dig example.com A +trace

The first command should print the IP address and the record’s TTL (1799 seconds with Namecheap’s Automatic setting):

example.com. 1799 IN A 198.51.100.42

Once DNS returns the right IP, use curl to trace the redirect headers and verify there are no redirect loops:

curl -ILs https://www.example.com | grep -iE "^(HTTP/|location)"

When you see HTTP/2 301 redirecting to https://example.com/ followed by HTTP/2 200, your routing works.

Common Root Domain Mistakes in Namecheap

Most root domain problems in Namecheap come down to these four mistakes:

  • Typing the full domain in the Host field: In Namecheap BasicDNS, entering example.com creates a record for example.com.example.com. Always use @ for the root domain.
  • Leaving default parking records active: Namecheap usually pre-populates a URL Redirect Record on @ and a parking-page CNAME on www when you register a domain. If you add an A record without deleting those default entries, resolvers get conflicting data.
  • Entering IPs into CNAME fields: CNAME values must be hostnames, never IP addresses. If you have an IP, select the A Record type.
  • Negative DNS caching: If you visited your domain before adding records, your OS cached an NXDOMAIN response based on the SOA negative TTL (often 300 to 3600 seconds). Clear your local cache using sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder on macOS or ipconfig /flushdns on Windows.

Frequently Asked Questions

Can I point my root domain to a CNAME in Namecheap BasicDNS?

Not with a CNAME record. RFC 1034 does not allow a CNAME to coexist with the SOA and NS records every root has, and Namecheap warns that a CNAME on @ breaks MX records. Use an A record, an ALIAS record (Namecheap’s CNAME-like type for the root), or a URL Redirect.

How long does Namecheap DNS propagation take for root domains?

Changes made inside Namecheap BasicDNS usually take effect within 5 to 30 minutes. If you are changing authoritative nameservers on the domain, global propagation can take up to 24 to 48 hours.

What should I put in the Host field for the root domain?

Always enter @. In DNS zone conventions, @ is shorthand for the origin, which is the root domain itself. Namecheap adds your domain name to whatever you type in the Host field, so typing example.com there creates a record for example.com.example.com.

Can I have both an A record and a CNAME record on the root domain?

No. DNS rules forbid a CNAME alongside any other record on the same host label, so keep only the A record, or replace both with a single ALIAS record. If your host gave you a hostname for the root, the ALIAS record is the one to keep.

Next Steps

Once dig returns the right answer for both example.com and www.example.com, issue the certificate for both names and keep one of them as your main address. If the domain also has email, run dig MX example.com +short to confirm the mail records survived your changes, then make sure SPF, DKIM and DMARC are in place with our guide on how to configure SPF, DKIM, and DMARC records in Namecheap DNS.

all_in_one_marketing_tool