title: .htaccess Redirect non-WWW to WWW preserving URI string
body: <p>I'm running the CodeIgniter platform, which uses .htaccess to accept URLs like</p>
  
  <pre><code>http://www.mysite.com/controller/function/argument
  </code></pre>
  
  <p>I currently use some .htaccess rewrites, namely (simplified):</p>
  
  <pre><code>RewriteEngine On
  RewriteCond %{REQUEST_URI} !^(/index\.php|/images|/assets)
  RewriteRule ^(.*)$ /index.php/$1 [L]
  </code></pre>
  
  <p>I want to add a rewrite rule that redirects all non www requests to www. I also want the URI string following the domain name to stay the same in the redirect. For instance, if a user makes a request for <code>http://mysite.com/controller/function/argument</code>, I want the .htaccess file to rewrite the request in the browser as <code>http://www.mysite.com/controller/function/argument</code> and then process the request.</p>