Step 1: Login to your cPanel account.
Step 2: Navigate to Domains section > Subdomains menu.
Step 3: Create a subdomain * pointing it to the necessary folder (you will need to specify the path in the field Document Root).
Step 4: Go to 'Advanced Zone Editor' menu.
Step 5: Make sure that there is an A record for *.yourdomain.com created and pointed to the server IP address.
Step 6: Now, you will need to wait until the propagation is over and then the wildcard subdomain will work correctly.