title: mod_rewrite Redirect to specific URL if domain X is used?
body: <p>I have a site with two domains. I want that whenever domain X is visited (no matter what the path is... /foo/bar/, root or whatever), the browser should redirect to a specific URL.</p>
  
  <p>So:</p>
  
  <pre><code>domainX.com -&gt; domainX.com
  domainY.com -&gt; domainX.com/some/path
  </code></pre>
  
  <p>The following kinda sorta works, but it only matches against <code>domainY.com</code>, so <code>www.domainY.com</code> or <code>domainY.com/some/path</code> doesn't work.</p>
  
  <pre><code>RewriteCond %{HTTP_HOST} ^domainY\.com
  RewriteRule ^(.*)$ http://domainX\.com/some/path [L]
  </code></pre>
  
  <p>It has to accept both with and without www before though. Any ideas?</p>