title: .htaccess combined 301 redirect, and URI rewriting
body: <p>I've got a very simple .htaccess file that enables the rewrite engine, and lets me use URI's in my web applications.</p>
  
  <p>The problem is i need to do a 301 redirect to get my webaddress without www redirected to my website WITH www (While keeping the current rewrite function that redirects every subdirectory access to index.php in the root of my domain), to optimize seo. I just can't get it to work. :(</p>
  
  <p>So in short terms i need to combine the current code which is:</p>
  
  <pre><code>RewriteEngine on
  RewriteRule ^(.+)/$ index.php
  </code></pre>
  
  <p>With the 301 rewrite rule which is</p>
  
  <pre><code>RewriteEngine on
  RewriteCond %{HTTP:Host} ^website\.com$
  RewriteRule (.*) http\://www.website.com$1 [NC,R=301]
  </code></pre>
  
  <p>My server is running Apache, with the mod rewrite enabled.</p>
  
  <p>Thanks in advance</p>