title: How to redirect from a subdomain to a subfolder using .htaccess
body: <p>I need help redirecting a subdomain to a subfolder on my website using the .htaccess file. I am not a pro in regards to configuring the .htaccess file, so please forgive me if my problem is a simple fix.</p>
  
  <p>In my .htaccess file, I have the following code:</p>
  
  <pre><code>RewriteCond %{HTTP_HOST} ^subdomain\.domain\.com  
  RewriteRule ^(.*)$ /subfolder/$1 [R=301]
  </code></pre>
  
  <p>It almost works, but when I enter <strong>subdomain.domain.com</strong> into the address bar, I get redirected to <strong>subdomain.domain.com/subfolder/</strong></p>
  
  <p>This is really close, but I don't want the preceding subdomain in the redirected URL, I want the redirection to go to <strong>domain.com/subfolder/</strong></p>