Set mod-rewrite to forward everything accept for one subdomain I am trying to set up mod rewrite to forward the site example.com to www.example.com. This is fairly easy, because there is a line in the built in .htaccess file that I just have to uncomment. The problem is, I can't figure out how to set it so that all domains of example.com forward to www.example.com, accept m.example.com which I want to keep the same. These are the line's I'm using right now: 

RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]


How can I set it to so that only m.example.com stays the same?
Something like this should do it:

RewriteCond %{HTTP_HOST} !^(www|m)\. [NC]
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]