site on subdomain is redirecting to main site after installing wildcard ssl cert on both

Change your first 3 lines of your .htaccess to the follow. the code needs to go into the apache IfModule mod_rewrite

<IfModule mod_rewrite.c>
RewriteEngine On 
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]