I have many add-on domains in my hosting account. After purchasing an SSL certificate, which is supposed to be meant for the main website, one of the add-on domains, mexabet.biz through any other add-on domain by adding https:// in front like this:
https://devzeal.com/mexabet.biz/ or https://www.devzeal.com/mexabet.biz/
Below is what I did to try to prevent this issue:
RewriteCond %{SERVER_PORT} ^443$
RewriteRule !^(devzeal.biz|devzeal.com|devzeal.info|devzeal.net|devzeal.org|zinitech.biz|zinitech.com|zinitech.info|zinitech.net|zinitech.org|mexabet.biz|mexabet.com|mexabet.info|mexabet.net|mexabet.org|mexabet.us|mexasoft.com|seotreats.com|zinsolar.biz|zinsolar.com|zinsolar.info|zinsolar.net|zinsolar.org)$ https://www.maindomain.com/mywebmail/ [R=301,L]
However, the above .htaccess configuration redirects properly only when you try to access a URL like https://www.devzeal.com/, but it doesn't redirect when you access https://www.devzeal.com/mexabet.biz/ or https://devzeal.com/mexabet.biz/innerdirectory.

I will appreciate any help to redirect every https:// to https://www.maindomain.com/mywebmail/