To make react router work i changed the .htacsess and added the code below :
DirectoryIndex index.html
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.html [L,QSA]
then added this line
RewriteCond %{REQUEST_URI} !^sw\.js$
to make it exclude sw.js but it doesn't seem to exclude sw.js and requesting domain.com/sw.js still serves the index.html
here is my full .htaccess file :
DirectoryIndex index.html
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^sw\.js$
RewriteRule ^(.*)$ /index.html [L,QSA]