title: 301 Redirect all pages to root, not index.html, and also redirect all non-www to www
body: <p>I've been looking for a precise answer to this question for awhile but couldn't find it. </p>
  
  <p>I've launched a one page website in place of an old website with many pages. Now, I want to redirect everything to www.domain.com. The page uses index.html as the homepage, but I don't want to redirect to that, I just want to redirect to the www.domain.com root. </p>
  
  <p>I tried using: </p>
  
  <pre><code>RewriteRule ^.+$ / [R=302,NC,L]
  </code></pre>
  
  <p>But that just broke my stylesheet and didn't redirect anything. Other solutions I've seen have redirected to the index.html but I want to redirect to the / root domain. </p>
  
  <p>Also, I want to be sure to redirect all non-www pages to www pages too. Can someone please help me out?</p>
  
  <p>Much appreciated</p>