RewriteCond %{HTTP_HOST} ^olddomain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.olddomain.com$
RewriteRule ^/?(.*)$ "http\:\/\/www\.newdomain\.com\/$1" [R=301,L]
RewriteCond %{HTTP_HOST} ^newdomain.com [NC]
RewriteRule ^(.*)$ [newdomain.com...] [L,R=301]
If the preceding is actually what you have in the file, the following is a more efficient and correct way of doing thing, assuming for some reason the two sites use the same .htaccess file.
RewriteCond %{HTTP_HOST} ^(www\.)?olddomain\.com$
RewriteRule ^(.*)$ http
://www.newdomain.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} !^(www\.newdomain\.com)?$
RewriteRule ^(.*)$ http:
//www.newdoamin.com/$1 [R=301,L]
The . (dot) should be escaped in the condition and on the left side of the rule, but not the right. Also, there is no need to escape the / character. () are used for grouping, and the ? character means 0 or 1 of the preceding character or group of characters, so (www\.)? means with or without the www.
You only need the / on the left side of the rule in the httpd.conf file, so if you are using httpd.conf for your redirects you will want to change what I have on the left side of the rule to: RewriteRule ^/(.*)$ if you use the .htaccess you can leave the /? out and you will get the same result.
[NC] means No Case, and all modern browsers lowercase requests before sending AFAIK, so IMO it's really unnecessary where it was.
In the second ruleset I switched from a positive match to a negative match, which may need to be adjusted if you need to use subdomains other than www, which could be added like this:
RewriteCond %{HTTP_HOST} !^((www|another-sub-domain)\.newdomain\.com)?$
The ! at the beginning means NOT, and the bar character means OR, so the preceding rule says if the HTTP_HOST is NOT www.newdomain.com OR another-sub-domain.newdomain.com OR empty then redirect to www.newdomain.com.
If the sites do not use the same .htaccess (or httpd.conf) file, then in the oldsite.com .htaccess the following should be sufficient:
RewriteRule ^(.*)$ http
://www.newdomain.com/$1 [R=301,L]
As far as the rankings go, what type of keyword inclusion did you change from, to WRT searches?
Did you change from somenonsenseword.com to keyword.com or keyword-keyword.com to betterkeywordwithoutthehyphen.com?
[edited by: TheMadScientist at 2:54 am (utc) on Feb 12, 2010]