2
votes

I wish to redirect an entire domain except for 1 subdomain to another site.

I'm trying to get:

http://domain.com

http://www.domain.com

to redirect to another website/domain.

I want subdomain.domain.com to remain unaffected.

So far I have only managed to get either the www or the non www versions to redirect but not both at the same time.

Any assistance would be much apreciated.

1

1 Answers

6
votes
RewriteEngine On
RewriteCond %{HTTP_HOST} !^subdomain\.domain\.com
RewriteRule ^(.*)$ http://www.another-domain/$1 [R=301,L]