title: Changing Site Domain
body: <p>Quick htaccess question</p>
  
  <p>I am changing the domain associated with a site and want to know if I can setup the htaccess to make the following types of redirects:</p>
  
  <p><strong>Redirect</strong>
  <a href="http://www.oldomain.com/contact-us" rel="nofollow">http://www.oldomain.com/contact-us</a></p>
  
  <p><strong>to</strong>
  <a href="http://www.newdomain.com/contact-us" rel="nofollow">http://www.newdomain.com/contact-us</a></p>
  
  <p>Basically a global redirect that redirects to the new domain but keeps the rest of the URL that the user typed.</p>
  
  <p><strong>UPDATE:</strong>
  I ended up using the following code and it works perfectly</p>
  
  <pre><code>Options +FollowSymLinks
  RewriteEngine On
  RewriteCond %{HTTP_HOST} ^olddomain.com$ [OR]
  RewriteCond %{HTTP_HOST} ^www.olddomain.com$
  RewriteRule (.*)$ http://www.newdomain.com/$1 [R=301,L]
  </code></pre>