title: htaccess subdomain rewrite
body: <p>It is many topics here about subdomains but no one can help me...</p>
  
  <p>I use htacces to set subdomain to folder </p>
  
  <p>So if we put <a href="http://en.example.com/something" rel="nofollow">http://en.example.com/something</a> </p>
  
  <p>I use something like this..</p>
  
  <pre><code>RewriteCond %{HTTP_HOST}  ^([^.]+)\.example\.com$ 
  RewriteRule ^(.*)$        http://example.com/%1/$1 [NC]
  </code></pre>
  
  <p>This works fine but adress in bar is changed to <a href="http://example.com/en/something" rel="nofollow">http://example.com/en/something</a> but I want keep <a href="http://en.example.com/something" rel="nofollow">http://en.example.com/something</a></p>
  
  <p>so I tried this</p>
  
  <pre><code>RewriteCond %{HTTP_HOST}  ^([^.]+)\.example\.com$ 
  RewriteRule  ^([^.]+)\.example\.com(.*)   /$1/$2
  </code></pre>
  
  <p>or just </p>
  
  <pre><code>RewriteCond %{HTTP_HOST}  ^([^.]+)\.example\.com$ 
  RewriteRule ^(.*)$        %1/$1 [NC]
  </code></pre>
  
  <p>but this doesn't work. Any solution or ideas ?  </p>
  
  <p>One solution is use language there (http://example.com/en/something) where I rewrite it but after If I work on subdirectories I get something like <a href="http://example.com/subdirectory/en/something" rel="nofollow">http://example.com/subdirectory/en/something</a> - terrible. 
  Maybe I like <a href="http://example.com/en/subdirectory/something" rel="nofollow">http://example.com/en/subdirectory/something</a> bud how proceed this...</p>
  
  <p>And also on some private servers first one case send me to "maybe" default domain, so it is not working for me. (maybe this is some server condition or settings)</p>