If domain wildcarding doesn't work on a multisite network, the root cause can often be traced to configuration issues within DNS settings, server setup, WordPress configuration, or SSL/TLS handling. The solutions generally involve verifying and correcting these configurations to ensure wildcard subdomains function as intended.
Understanding Domain Wildcarding in Multisite Networks
Wildcarding in a multisite network allows any subdomain under the main domain to automatically resolve to the network's server without individual DNS entries for each subdomain. This requires:
1. Correct DNS wildcard records pointing all subdomains to the server IP.
2. Proper server configurations recognizing and routing wildcard subdomains.
3. WordPress multisite configured to use subdomains with wildcard mapping enabled.
4. SSL/TLS certificates covering all subdomains, often requiring wildcard certificates.
Failing in any of these steps can make wildcarding seem non-functional.
Common Causes and Troubleshooting Steps
1. DNS Wildcard Record Issues
The first step is ensuring the DNS has a proper wildcard record. This record typically looks like:- A wildcard `A` record: `*.yourdomain.com` pointing to your server's IP address.
Without this, subdomains won't resolve to the server. Common issues include:
- DNS changes not propagated fully yet.
- Conflicting DNS records that override or negate wildcards.
- Using CNAME wildcards incorrectly instead of A records.
- DNS managed at a different provider or server where wildcard is not set.
If DNS wildcards are present but some subdomains fail to resolve intermittently, it could be due to DNS caching issues or propagation delays.
2. Server Configuration and Virtual Hosts
The web server (Apache, Nginx, LiteSpeed, OpenLiteSpeed, etc.) needs to be configured to accept wildcard subdomains.- Virtual host or server block should have a `ServerAlias` entry for `*.yourdomain.com`.
- If on cPanel, a wildcard subdomain must often be created in the control panel instead of just relying on DNS.
- Overlapping or conflicting virtual host rules can cause routing issues where wildcard subdomains are redirected or ignored.
- On some hosts like DirectAdmin, wildcard DNS can cause problems with other subdomains because wildcard rules are prioritized. Custom adjustments in httpd configuration may be required.
- For third-level subdomains (like `*.subdomain.domain.com`), specific extra configuration rules may be needed, such as custom rewrite rules or explicit server alias declarations.
If the server is misconfigured, browsers may show errors like "This site can't be reached" or site errors from the hosting company because requests never reach the WordPress installation portion.
3. WordPress Multisite Configuration
WordPress multisite must be set up correctly as a subdomain network:- The `wp-config.php` file should include correct multisite constants.
- Network setup in WordPress must be done with subdomains enabled.
- Sites created in the network must correspond accurately to DNS and server routing.
- Domain mapping plugins or configurations (if used) should not conflict with wildcard subdomains.
- Clear caching (both in WordPress and server) to ensure new subdomains are recognized.
If multisite is configured as subdirectory instead of subdomain, wildcard subdomains won't work.
4. SSL/TLS Certificate Management
SSL can interfere with domain wildcarding:- If using HTTPS, a wildcard SSL certificate covering `*.yourdomain.com` is essential.
- Traditional single-domain certificates will cause warnings or errors when accessing subdomains.
- Let's Encrypt can provide free wildcard certificates but may impose rate limits causing certificate renewal failures, impacting subdomain accessibility.
- For mapped domains outside the network's main domain, separate SSL certificates may be needed.
- HTTPS redirection in `.htaccess` or server configs must not conflict with domain mapping or wildcard subdomain routing.
5. Browser Cache and Plugin Interference
Sometimes issues arise from:- Browser cache still pointing to previous IP or non-existent subdomains.
- WordPress caching or security plugins interfering with subdomain routing.
- CDN or proxy services misconfigured with wildcard domains.
Clearing browser caches, disabling plugins temporarily, and testing with CDN bypass can help isolate such issues.
Advanced Troubleshooting
Inspect DNS with Tools
Use online tools to verify DNS wildcard presence and resolution for subdomains that fail. Check for:- A records for `*.yourdomain.com`.
- Specific A or CNAME records overriding wildcards.
- DNS propagation status.
Check Server Access and Error Logs
Check server access logs and error logs for:- Requests to unknown or unmapped subdomains.
- 404 or 403 errors indicating misrouting.
- SSL errors related to certificate mismatch or failures.
- Permission issues affecting mapping.
Use Debugging in WordPress
Enable debugging in WordPress by adding in `wp-config.php`:php
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
Check debugging logs in `wp-content/debug.log` for clues on domain resolution issues.
Potential Solutions and Fixes
- Reconfirm DNS wildcard setup: Remove and re-add the `*.yourdomain.com` A record pointing to the server IP in the authoritative DNS provider.
- Create wildcard subdomain in hosting control panel: For cPanel or similar, explicitly create a wildcard subdomain.
- Modify web server configuration: Add or fix `ServerAlias *.yourdomain.com` in Apache or `server_name *.yourdomain.com` in Nginx.
- Fix domain mapping order: In some panels, wildcard rules may override other subdomains. Adjust virtual hosts priority accordingly.
- Get and install wildcard SSL certificate: Use Let's Encrypt or commercial certificates to cover all subdomains.
- Clear caches: Clear DNS cache (locally via `ipconfig /flushdns` or `dns-clean`), browser cache, and WordPress/plugin caches.
- Check for conflicting plugins: Diagnose with plugins disabled and test again.
- Rewrite rules for complex domains: Add `.htaccess` or server rewrite rules for third-level or multi-level wildcard subdomains.
- Verify WordPress multisite settings: Check `Network Setup` in WordPress to confirm subdomain configuration and site listings.
Key Considerations
- Wildcard subdomains only work if DNS and server are correctly configured to direct all subdomains to WordPress.
- Some hosts do not support wildcard subdomains or require manual DNS and panel configuration.
- SSL certificates must include wildcards or separate domains to avoid HTTPS errors.
- When domain mapping external domains, wildcard certificates do not cover those domains; separate SSL solutions are needed.
- Multisite network configuration mistakes, especially in `wp-config.php` or `.htaccess`, can break wildcard subdomain handling.
- Hosting control panels may have their own idiosyncrasies affecting wildcard subdomain support.
- Third-level or deeper subdomain wildcards can be trickier and may require custom server rules.
Summary of Steps to Take When Wildcarding Fails
1. Verify DNS wildcard records exist and point correctly.
2. Ensure hosting/server environment supports and recognizes wildcard subdomains.
3. Check and update web server configuration for wildcard ServerAlias directives.
4. Confirm WordPress multisite is set up with subdomain mode enabled.
5. Obtain and correctly install wildcard SSL certificate if using HTTPS.
6. Clear caches and disable conflicting plugins or CDN proxies for testing.
7. Review server logs and WordPress debug logs to identify misconfigurations.
8. Consult host support if DNS or server-level wildcarding is restricted or problematic.