title: Generic htaccess redirect www to non-www
body: <p>I would like to redirect <code>www.example.com</code> to <code>example.com</code>. The following htaccess code makes this happen:</p>
  
  <pre><code>RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
  RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]
  </code></pre>
  
  <p>But, is there a way to do this in a generic fashion without hardcoding the domain name?</p>