title: htaccess redirect only if domain matches
body: <p>I have a problem where I need to redirect my domain before it hits php. By the time it hits the ability to execute a header, it is too late.</p>
  
  <p>How can I do</p>
  
  <pre><code>if (domain == 'www.example.com')
  redirect www.domain.com;
  </code></pre>
  
  <p>in my .htaccess?</p>