mod rewrite in your .htacces file should do it. Make sure to include $1 at the end of the domain to carry any other url page parameters in the rewrite like this:
RewriteEngine On
# Rewrite domain diff
RewriteCond %{HTTP_HOST} ^firstdomain\.com
RewriteRule ^(.*)$
http://www.seconddomain.com/$1/?name=vanity [R=301,L]