title: htaccess rewrite rule: Replace domain, keep the rest
body: <p>I'm looking for a simple rewrite rule that does the following:</p>
  
  <p>Example:</p>
  
  <pre><code>http://old.com -------&gt; http://new.com
  
  http://old.com/sub1 -------&gt; http://new.com/sub1
  
  http://old.com/sub1/sub2 -------&gt; http://new.com/sub1/sub2
  </code></pre>
  
  <p>etc.</p>
  
  <p>So it just needs to replace the domain name, everything else shouldn't be changed.</p>
  
  <p>I tried this one, but it doesn't really work on my WordPress. What am I doing wrong?</p>
  
  <pre><code>RewriteCond %{HTTP_HOST} ^(www\.)?old\.com$ 
  RewriteRule ^(.*)$ http://new.com/$1 [L,R=301]
  </code></pre>