1. Websta Hosting
Domains & DNS

Setting Up Wildcard Subdomains

Setting Up Wildcard Subdomains

A wildcard subdomain routes all subdomains (e.g. anything.yourdomain.com) to your site, letting your application handle the routing logic.

Common Use Cases

  • SaaS applications where each customer gets their own subdomain
  • Multi-site WordPress installations
  • Tenant-based applications

Step 1: Add a Wildcard DNS Record

In DirectAdmin → DNS Management → Add Record:

Name:  *
Type:  A
Value: [your server IP address]
TTL:   3600

This routes all *.yourdomain.com to your server.

Step 2: Add a Wildcard Subdomain in DirectAdmin

Go to Subdomains → create a subdomain with * as the prefix.

Not all DirectAdmin versions support wildcard subdomains via the panel. Contact support if needed.

Step 3: Configure Your Application

Your application must handle routing by reading the subdomain from HTTP_HOST. Example in PHP:

$subdomain = explode('.', $_SERVER['HTTP_HOST'])[0];
// Route to the correct tenant

Step 4: Wildcard SSL Certificate

A standard Let's Encrypt certificate doesn't cover wildcard subdomains. For wildcard SSL:

  1. Contact support — we can issue a wildcard certificate (*.yourdomain.com) using DNS challenge.
  2. Or use Cloudflare, which provides wildcard SSL on the free plan.
Still need help?

If this article didn't answer your question, our support team can help.

Contact support
All articles More in Domains & DNS