Redirect Old Domain to New Domain

How to redirect old domain to new domain through .htaccess? You should add this code in .htaccess file

Method no 1

Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]

Method no 2

Redirect 301 / http://www.newdomain.com/