So you are pas looking at redirection as such (as that happens at le app level, i.e. on Apache/Nginx/wherever) mais plutôt on le DNS resolution. The host on qui DomainA is hosted will ou should jamais be hit, based on votre description as you want le DNS requests to be resolved to le IPs of DomainB. Unless Je suis missing something in votre request?
As Shane pointed out DNS is pas capable of HTTP redirection - c'est an application/webserver duty. You could make DomainA et DomainB resolve to le même IP on DNS et tous would work. But si you're looking to do this on per URL/per-path way alors this is pas possible - DNS is pas capable of that - c'est a simple DNS->IP service, quel est happening avec le actual URL is le webserver's task.
After le comment below, what J'aimerais do is to refer tous DNS records for DomainA to le même IP(s) as DomainB is pointed to - this way you will get HTTP request hitting hostB et alors c'est juste a simple matter of:
Cela va rewrite anything coming to DomainB to DomainA qui can be hosted on le même server ou somewhere else. I appreciate that le second option is probably an overhead et pas nécessaire si you can/are allowed to create Name Based Virtual hosts on apache.
<VirtualHost *:80>
ServerName DomainB
Redirect permanent / http://DomainA/
</VirtualHost>
J'aimerais go avec 1. - point tous DNS records of DomainA to le même IP(s) as DomainB is pointing et create particular Name Based VirtualHosts on Apache.