Applies to: DNS records in cPanel Zone Editor, Cloudflare and other DNS providers

A wildcard DNS record answers for every subdomain that doesn’t have its own record. With *.example.com pointing to your server, shop.example.com, anything.example.com and even a.b.example.com all reach that server, without creating each name separately. It is useful for multi-tenant apps, WordPress Multisite with subdomains and catch-all landing pages.

How it behaves

We tested a zone with a wildcard on a BIND 9 DNS server:

  • *.example.com A 203.0.113.20 made random.example.com, shop.example.com and a.b.example.com all answer 203.0.113.20.
  • Names with their own record win: www.example.com kept its own address.
  • The wildcard doesn’t cover the domain itself (example.com), which needs its own A record.
  • It only covers the record type you create: a wildcard A record doesn’t create MX or TXT records for those names.

Add it in cPanel

  1. Open Domains › Zone Editor and click Manage next to the domain.
  2. Click Add Record, choose type A.
  3. Name: *.example.com. Address: your server’s IP address. Save.

For the website to answer on those names too, the web server must accept them: in cPanel, add *.example.com as a domain in Domains › Domains (a wildcard subdomain), or ask our support team.

At Cloudflare or another DNS provider

Add an A (or CNAME) record with the name *. Most providers add the domain automatically.

Check it

dig +short anything-you-like.example.com A
dig +short www.example.com A

SSL for every subdomain

A normal SSL certificate covers only the names listed in it. To secure all subdomains you need a wildcard certificate (*.example.com), which requires DNS-based validation. See our SSL certificates.

Be careful with wildcards

  • Every mistyped subdomain now reaches your server, so make sure your site shows something sensible (or redirects) for unknown names.
  • Don’t leave a wildcard pointing at a service you no longer use: anyone could then serve content under your domain if they take over that service.

More about DNS records in cPanel: how to add a CNAME record. Changes not showing? Flush your DNS cache.

Was this answer helpful? 0 Users Found This Useful (0 Votes)