How to create a Wildcard subdomain in cPanel?
Last update: 08/Apr/2024
VERY IMPORTANT: Wildcard subdomain supports on CPanel, aaPanel and some other web hosting panels. Please check with your hosting provider or web hosting panel support. It doesn’t work in hPanel.
https://www.namecheap.com/support/knowledgebase/article.aspx/9191/29/how-to-create-a-wildcard-subdomain-in-cpanel/
Note:
After adding the wildcard subdomain to DNS, go to .env and enter SUB_DOMAIN and MAIN_DOMAIN in your domain URL (don't use http or https).
For example:
SUB_DOMAIN=www
MAIN_DOMAIN=domain.com (Use your domain instead of "domain")
If you're using a script on a subdomain, go to .env and enter SUB_DOMAIN and MAIN_DOMAIN in your domain URL (don't use http or https).
For example:
SUB_DOMAIN=subdomain (Use your subdomain instead of "subdomain")
MAIN_DOMAIN=domain.com (Use your domain instead of "domain")