title: htaccess mod_rewrite: Redirect all subdomains, exclude some
body: <p>There are many similar questions, but I couldn't find an answer to this specific one:</p>
  
  <p>In my .htaccess I have a rewrite to redirect all subdomains to <a href="http://example.com" rel="nofollow">http://example.com</a>:</p>
  
  <pre><code>RewriteCond %{HTTP_HOST} !^example\.com$ [NC]
  RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]
  </code></pre>
  
  <p>But I want it to ignore dev.example.com (and maybe some other subdomains). I guess that's easy, but I can't figure it out.</p>