title: react-router redirect to index.html AND remove www from url in .htaccess
body: <p>I'm building a small app in ReactJS, so all pages need to serve index.html and the JS handles the url. This works fine. But I'd also like to have .htaccess remove www from the url if it exists. I'm reading through the mod_rewrite documentation and I can't quite figure out how to make it do both.</p>
  
  <p>Here is my code in .htaccess, please advise!</p>
  
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
      RewriteEngine on
      RewriteCond %{REQUEST_FILENAME} -s [OR]
      RewriteCond %{REQUEST_FILENAME} -l [OR]
      RewriteCond %{REQUEST_FILENAME} -d
      RewriteRule ^.*$ - [NC,L]
      RewriteRule ^(.*) /index.html [NC]
      RewriteCond %{HTTP_HOST} ^www.(.+)$ [NC]
      RewriteRule ^(.*)$ http://%1/$1 [R=301,L] 
  &lt;/IfModule&gt;
  </code></pre>