title: .htaccess Rewrite Rules for subdomain
body: <p>I use codeigniter as my main install on the main domain. I have created a subdomain and a folder called live e.g. live.domain.com maps to public/live . However in public I use codeigniter.</p>
  
  <p>I now have the dynamic codeigniter url: </p>
  
  <pre>http://domain.com/api/</pre>
  
  <p>which I want to map to my subdomain: </p>
  
  <pre>https://live.domain.com</pre>
  
  <p>So going to:</p>
  
  <pre>https://live.domain.com/api/functioname</pre>
  
  <p>would be using the script: </p>
  
  <pre>http://domain.com/api/apifunctioname</pre>
  
  <p>and possibly:</p>
  
  <pre>http://domain.com/api/apifunctioname/parameter1/parameter</pre>
  
  <p>Everything is on the same server so no redirects are needed.</p>
  
  <p>Anyone have any ideas on which rewrite rules to use?</p>
  
  <pre><code>Options +FollowSymLinks
  
  RewriteEngine On
  
  RewriteCond %{HTTP_HOST} ^live\.domain\.com [NC]
  RewriteRule (.+)$ "http://domain.com/api/$1" [L]
  </code></pre>
  
  <p>The above works great as a rewrite but redirects to <a href="http://domain.com/api/functionname" rel="noreferrer">http://domain.com/api/functionname</a> instead I want it to route; so that when going to:</p>
  
  <pre>https://live.domain.com/api/functioname</pre>
  
  <p>It stays at that url but uses the script of </p>
  
  <pre>http://domain.com/api/functionname</pre>
  
  <p>Thank you very much,</p>
  
  <p>Ice</p>