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
Answered my own question
<IfModule mod_rewrite.c>
RewriteEngine On
# remove www
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^www.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L,NE]
# redirect all to index
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.html [L,NC]
</IfModule>