title: Redirect subdomain to different locations based on url
body: <p>I have a website on a domain that I want to move to another domain. Here is my problem. The root URL has to redirect to a different location on the new domain. Example:</p>
  
  <pre><code>http://subdomain.olddomain.com/ must redirect to http://www.newdomain.com/location
  
  http://subdomain.olddomain.com/code/slug must redirect to http://www.newdomain.com/slug
  </code></pre>
  
  <p>The htaccess code that I have doesn't work ver</p>
  
  <pre><code>RewriteRule ^/?(.*) http://www.newdomain.com/$1 [R=302,L]
  </code></pre>
  
  <p>This code works for the second example, but nog on the first. Can anyone help me setup the correct htaccess code?</p>