How to Route Subdomains to Different Servers in Namecheap DNS

by Fahim

Running a marketing site on WordPress, an API on a VPS, and docs on a static host means routing subdomains to completely different IPs and hostnames. You don’t need a third-party DNS provider or complex nameserver migrations for this—Namecheap’s built-in BasicDNS handles multi-server routing fine on its own.

Here is how to split your subdomains across different servers in Namecheap Advanced DNS, handle CNAME quirks, verify your records from the terminal, and wire up independent SSL certificates.

Close-up of server rack network cables representing routing subdomains across multiple servers
Close-up of server rack network cables representing routing subdomains across multiple servers

The Multi-Server Architecture Explained

When you register a domain like example.com, your registrar’s authoritative nameservers decide where traffic goes. Keeping DNS management inside Namecheap gives you full control over individual host records. In practice, a split architecture usually looks something like this:

  • Apex domain (example.com) & www: Main marketing site on shared hosting or WordPress.
  • api.example.com: Node.js, Go, or Python backend running on a dedicated VPS instance.
  • app.example.com: Frontend Single Page Application (SPA) hosted on a CDN or cloud platform.
  • docs.example.com: Static documentation hosted on GitHub Pages or ReadMe.

To wire this up, we use A records for direct IPv4 addresses and CNAME records for external hostnames inside Namecheap’s dashboard.

Step 1: Check Nameserver Settings in Namecheap

Before touching any host records, make sure your domain actually uses Namecheap’s native DNS. If your domain points to external nameservers (like Cloudflare or a web host’s nameservers), editing records in Namecheap won’t do anything to live traffic.

  1. Log in to Namecheap and go to your Domain List.
  2. Click Manage next to your domain.
  3. Find the Nameservers section under the Domain tab.
  4. Make sure the dropdown is set to Namecheap BasicDNS or Namecheap Web Hosting DNS.
  5. If you changed it, hit the green checkmark to save.

If you recently moved your primary site over, double-check how to point Namecheap DNS to your host without breaking email before editing more records.

Step 2: Add Subdomain A Records for Dedicated Servers

An A Record maps a subdomain straight to an IPv4 address. Use this whenever you’re pointing traffic directly to a VPS, dedicated box, or cloud VM with a static public IP.

For example, if your API server lives at 198.51.100.42 and you want it on api.example.com:

  1. In Namecheap, open the Advanced DNS tab.
  2. Scroll to Host Records and click Add New Record.
  3. Choose A Record for the Type.
  4. In the Host field, enter only the subdomain prefix: api (do not type api.example.com).
  5. In the Value field, paste your server’s IPv4: 198.51.100.42.
  6. Set TTL to Automatic (or 5 min if you’re testing and want changes to apply fast).
  7. Click the green checkmark to save.

You can check if the record is live immediately using dig against Namecheap’s nameservers:

dig +short api.example.com @dns1.registrar-servers.com

This bypasses local ISP caching and asks Namecheap directly—it should return 198.51.100.42 right away.

Step 3: Route Subdomains with CNAME Records

A CNAME Record maps an alias name to another hostname instead of a raw IP. You’ll need this when pointing subdomains to external SaaS platforms, documentation hosts, or bucket origins that manage their own dynamic IPs.

For example, to point docs to an endpoint like custom-docs.provider.net:

  1. Under Host Records, click Add New Record.
  2. Select CNAME Record.
  3. In the Host field, type docs.
  4. In the Value field, enter your provider target: custom-docs.provider.net.
  5. Set TTL to Automatic and click the checkmark to save.

If you’re caching dynamic frontends or static assets closer to users, take a look at how to connect a Namecheap domain to an edge CDN for global edge delivery.

Step 4: Configure Web Server Virtual Hosts for the Subdomain

DNS only gets the packets to your server’s IP address. Once traffic hits the box, your web server has to read the incoming Host header and route it to the right internal app instead of serving your default fallback page.

Here is an Nginx virtual host block routing api.example.com to a local backend app on port 3000:

server { listen 80; listen [::]:80; server_name api.example.com; location / { proxy_pass http://127.0.0.1:3000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_cache_bypass $http_upgrade; }
}

Drop this in /etc/nginx/sites-available/api.example.com, symlink it to /etc/nginx/sites-enabled/, and test your configuration before reloading:

sudo ln -s /etc/nginx/sites-available/api.example.com /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx

Step 5: Provision Independent SSL Certificates per Server

Since each subdomain lands on a different physical or virtual machine, you can’t reuse a single standard TLS cert. You have two realistic options:

  1. Independent Let’s Encrypt Certs (Recommended): Run Certbot on each server for its specific subdomain. Zero cert syncing required.
  2. Wildcard SSL Certificate: Generate a single *.example.com cert via DNS-01 challenges and automate copying the keys across servers.

For separate servers, individual Let’s Encrypt certificates are much easier to maintain. Run this on your API server:

sudo certbot --nginx -d api.example.com --non-interactive --agree-tos -m admin@example.com

Certbot solves the HTTP-01 challenge through the A record we just pointed and injects the SSL directives right into your Nginx config. For a complete end-to-end deployment, see our walk-through on how to deploy a web app with Namecheap DNS and SSL.

Common Gotchas and Troubleshooting

Most subdomain routing issues trace back to three specific mistakes:

1. Typing the Full FQDN in Namecheap Host Field

Namecheap automatically appends your root domain to whatever you put in the Host field. If you type api.example.com, Namecheap creates a record for api.example.com.example.com. Always type just the prefix: api, docs, or staging.

2. Conflicting CNAME and A Records

According to IETF RFC 1912 (Section 2.4), a CNAME record cannot exist alongside any other record for the exact same host prefix. If you have an old parking A record for api and add a CNAME for api, lookups will fail randomly. Delete the old record first.

3. DNS Cache Stagnation

If you’re updating a record that previously had a long TTL (like 4 hours), your local resolver and ISP will hold on to the old IP until the TTL timer expires. Flush your local DNS cache from the terminal to test fresh:

# On macOS
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder # On Ubuntu / Debian
sudo systemd-resolve --flush-caches

Frequently Asked Questions

How many subdomains can I create in Namecheap DNS?

Namecheap lets you create up to 150 host records on BasicDNS. That’s plenty for routing staging environments, APIs, microservices, and static platforms.

Can I route a subdomain to a specific port on my server?

No. DNS A and CNAME records only translate hostnames to IP addresses—they don’t understand port numbers. Point the subdomain to your server’s IP, then use a reverse proxy like Nginx or Caddy to forward traffic to :3000 or :8080.

Will changing subdomain DNS affect my email delivery?

No. Adding A or CNAME records for new subdomains won’t touch root domain mail routing, as long as you leave your MX, SPF, DKIM, and DMARC TXT records alone. To double-check your existing email setup, see our guide on configuring SPF, DKIM, and DMARC records in Namecheap DNS.

How long does it take for subdomain DNS records to propagate?

Brand new subdomain records added to Namecheap BasicDNS usually resolve worldwide within 2 to 5 minutes. If you’re modifying an existing record, propagation speed depends entirely on the previous TTL you had configured.

all_in_one_marketing_tool