Forum Moderators: phranque
I would appreciate your help
Welcome to WebmasterWorld [webmasterworld.com]!
The code is intended to redirect all host names which are not "www.yourdomain.com" to www.yourdomain.com, so I think you're saying it is doing just that. If you wish to exclude "subdomain.oldomain.com" from being redirected, you'll need to add a second RewriteCond as shown.
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.olddomain\.com
RewriteCond %{HTTP_HOST} !^subdomain\.olddomain\.com
RewriteCond %{HTTP_HOST} !^123\.45\.67\.89
RewriteRule ^(.*)$ [olddomain.com...] [R=permanent,L]
An alternative is to rework the code so that only specific hostnames get redirected:
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^olddomain\.com [OR]
RewriteCond %{HTTP_HOST} ^(www\.)?newdomain\.com [OR]
RewriteCond %{HTTP_HOST} ^(www\.)?newdomain2\.com
RewriteRule ^(.*)$ [olddomain.com...] [R=permanent,L]
Note that the final RewriteCond in your list must not have an [OR] flag on it.
Ref: Introduction to mod_rewrite [webmasterworld.com]
HTH,
Jim