I\'ve got a VirtualHost that looks something like:
ServerName domain1.com ServerAlias www.domain1.com domain2.com www.domain2.com
No need for rewrites.
ServerName domain1.com ServerAlias domain2.com ... real vhost settings ... ServerName www.domain1.com Redirect permanent / http://domain1.com/ ServerName www.domain2.com Redirect permanent / http://domain2.com/