+254725682556 +254725052660 info@ziprof.co.ke
Client Area

DNS - Nameserver

What Is a Wildcard DNS Record and When Do You Need One?

A wildcard DNS record tells the internet where to send traffic for any subdomain of your domain that doesn't already have its own DNS record, even ones that don't exist yet. Instead of creating a record for blog.yourdomain.com, then another for shop.yourdomain.com, then another for every new subdomain you dream up, a single wildcard record catches all of them at once.

What a wildcard DNS record actually does

A wildcard record uses an asterisk (*) as the host name, written as *.yourdomain.com. Whenever a visitor's browser looks up a subdomain of your domain that has no specific record of its own, the wildcard record answers instead and routes the request to whatever destination you've set, usually an IP address (an A record) or another hostname (a CNAME record).

So if you set up *.yourdomain.com to point to your server's IP address, then anything.yourdomain.com, test123.yourdomain.com, and randomword.yourdomain.com would all resolve to that same server, even though you never created individual records for them.

How it's different from creating subdomains one by one

Creating a subdomain in your control panel (like shop.yourdomain.com) sets up both the DNS record and a folder on your hosting account for that subdomain's files. A wildcard DNS record only handles the DNS lookup part: it makes the hostname resolve, but it doesn't create any folder or hosting configuration for it. What happens once traffic reaches your server for an undefined subdomain depends entirely on how your application or website code handles it.

This is why wildcard DNS is normally used alongside an application that's built to read the subdomain from the request and decide what to show, not as a replacement for setting up subdomains through your control panel.

When you actually need one

  • You're running a platform where each customer or user gets their own subdomain (e.g. clientname.yourplatform.com) and new ones are created automatically, without you manually adding a DNS record each time.
  • You want a simple catch-all so that any typo or old link to a subdomain still lands on your main site instead of showing a DNS error.
  • You're testing an application that generates subdomains dynamically (staging environments, preview links, multi-tenant software) and don't want to keep editing your DNS zone.

If you only have a handful of subdomains and know exactly what they are, you're usually better off creating each one individually through your control panel. It's more predictable and easier to secure.

How to add a wildcard DNS record

In cPanel

  1. Log in to cPanel and open Zone Editor under the Domains section.
  2. Find your domain in the list and click Manage.
  3. Click Add Record and choose either A Record (to point to an IP address) or CNAME Record (to point to another hostname).
  4. In the name/host field, enter * followed by your domain, e.g. *.yourdomain.com.
  5. Enter the destination IP address (for an A record) or hostname (for a CNAME record).
  6. Save the record.

In DirectAdmin

  1. Log in to DirectAdmin and open DNS Management under the Domain Setup section.
  2. Select the domain you want to edit.
  3. Click Add New Record, then choose A or CNAME as the record type.
  4. In the name field, enter * to represent the wildcard.
  5. Enter the destination IP address or hostname, then click Add to save.
A wildcard DNS record only makes the subdomain resolve: it won't automatically secure it with HTTPS. If visitors will reach these subdomains over a secure connection, you'll need a wildcard SSL certificate that covers *.yourdomain.com as well, otherwise their browser will show a security warning. Also keep in mind that a wildcard record answers for every possible subdomain, including ones you never intended, so it can accidentally expose server misconfigurations or make it harder to notice a typo in a link.

If you only need a few subdomains set up ahead of time rather than an open-ended catch-all, see how to create a wildcard subdomain in cPanel and DirectAdmin, and if you're serving these subdomains over HTTPS, check how to install a wildcard SSL certificate.