title: .htaccess subdomain redirect
body: <p>My server is somehow configured to accept any string as a existing subdomian. This subdomains doesn't redirect, they show content instead. For example:</p>
  
  <p><strong>bla.example.com</strong> // shows the content of <a href="http://example.com" rel="nofollow">http://example.com</a></p>
  
  <p><strong>blabla.example.com</strong> // show the content of <a href="http://example.com" rel="nofollow">http://example.com</a></p>
  
  <p><strong>lorem.example.com/events/</strong> // shows the content of <a href="http://example.com/events" rel="nofollow">http://example.com/events</a></p>
  
  <p>So you can use "stackoverflow.example.com" and it will work. </p>
  
  <p>I want to create an <strong>.htaccess rule to overwrite this behavior</strong>. I want to redirect http://*.example.com/* to <a href="http://www.example.com/" rel="nofollow">http://www.example.com/</a>*</p>
  
  <p>Everything I have done so far is redirect <a href="http://example.com" rel="nofollow">http://example.com</a> to <a href="http://www.example.com" rel="nofollow">http://www.example.com</a> (wich is another behavior I want to keep)</p>
  
  <pre><code>RewriteCond %{HTTP_HOST} ^example\.com$
  RewriteRule (.*) http://www.example.com/$1 [R=301,L]
  </code></pre>
  
  <p>Thank you for your help!</p>