title: Redirect any subdomain to same subdomain of different domain
body: <p>I've moved my site from floriskleijne.nl to floriskleijne.com, and now want any visitor to any subdomain or subdirectory of .nl to be redirected to the .com equivalent of the URL. The challenge is in the subdomains: I have a number of those, and I want them to all be redirected to the equivalent subdomain on the new domain.</p>
  
  <p>So for instance,</p>
  
  <ul>
  <li>en2nl.floriskleijne.nl/ should redirect to en2nl.floriskleijne.com/</li>
  <li>www.floriskleijne.nl/about/the-author/ should redirect to <a href="http://www.floriskleijne.nl/about/the-author/" rel="nofollow noreferrer">http://www.floriskleijne.nl/about/the-author/</a></li>
  <li>floriskleijne.nl/about/the-author/ should <em>also</em> redirect to www.floriskleijne.nl/about/the-author/</li>
  </ul>
  
  <p>I found the solution in <a href="https://stackoverflow.com/questions/29187992/htaccess-redirect-subdomain-and-path-to-same-subdomain-and-path-on-another-do">this thread</a>, but this does not seem to work for me:</p>
  
  <pre><code>RewriteEngine On
  RewriteCond %{HTTP_HOST} ^(.+)\.floriskleijne\.nl$
  RewriteRule (.*) http://%1.floriskleijne.com/$1 [R=301,QSA,L]
  </code></pre>
  
  <p>There are two problems with this approach:</p>
  
  <ol>
  <li>It doesn't work on my site: a subdomain call to the .nl domain gives me an "Apache is working normally" page at the URL I enter, with apparently no redirection at all. And a subdomain call with subdirectories and/or files gives me a 404 error.</li>
  <li>Though this htaccess does the job of redirecting to .com, it seems to me that it ignores the no-subdomain version <a href="http://floriskleijne.nl" rel="nofollow noreferrer">http://floriskleijne.nl</a>. And indeed,iIf at all possible, I would want that to be redirected the same way (identical path). Oddly enough, floriskleijne.nl/whatever.subdir does get redirected properly.</li>
  </ol>
  
  <p>I've checked the DNS, and I have an A record for both floriskleijne.nl and *.floriskleijne.nl, both pointing to the same IP.</p>