Forwarding url without taking subdomains

Good day,
I hope you can help me. I have two websites, lets say A.com and B.com but i want to redirect people from A.com to B.com, however, A.com has a subdomain for example sub.A.com and that one I don’t want it to be redirected to B.com. So for example if someone trys to type A.com/Products, they will be redirected to B.com but if they put sub.A.com/Index, they would stay in A.com/Index.

What I tryed is adding a Forwarding URL rule, which it works redirecting http://A.com to B.com but doesn’t work with with www.A.com (nor http://A.com/* )

How can I achieve that?

Thank you very much

Create a bulk redirect rule for the apex only.