mod_rewrite ... keep path but change domain name

I’m basically switching the name of my design company from cocorobot.com to addedsugar.com. Now I have about 80+ pages from cocorobot.com indexed, and the directory structure is the same for the new addedsugar.com site (same site until I have time to redesign)

Anyway, the redirect that media temple (my host) told me to use works:

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^.*$ http://www.addedsugar.com [R]

However if someone comes to the site for example cocorobot.com/print-design/ I want the url to rewrite to addedsugar.com/print-design/ and not to addedsugar.com/. I’m not sure what I have to add to the above to make that work correctly.

If two sites are on different server:
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^(.*)$ http://www.addedsugar.com/$1 [R=301]

Served by the same Apache:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} cocorobot\.com$ [NC]
RewriteRule ^(.*)$ http://www.addedsugar.com/$1 [R=301]

trampt,

As much as I hate the EVERYTHING atom, that’s exactly the way to do it - but add a Last flag making [R=301] => [R=301,L] to mod_rewrite knows you’re done with that condition/rule set.

Regards,

DK