What code do I need to add to .htaccess to redirect my old domain to the new one, but to do this not for users, but only for the google bot. I have a variant of the code, but it doesn't work. It gives canonical to the old domain.
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} ^googlebot
RewriteRule ^(.*)$ http://new-domain.com/$1 [L,R=301]