I have two domains ponting to the same IP. www.domain1.com & www.domain2.com. I want domain2.com to be redirected to the domain1.com permanently (i.e 301) with the condition, when anyone visit domain2.com, he will be directed to domain1.com.

I have tried it with rewritecond, but the URL remains as domain2.com. I want it to change to domain1.com.

Below is a code I tried,

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.domain2.com$
RewriteRule index.html http://www.domain1.com [R=301]

Is there any way to write code like.....
Condition :
Redirect 301 :

Can anyone suggest the solution please...?