htaccess file not redirecting routes on my React App

by Chris   Last Updated August 14, 2019 04:00 AM - source

I am currenlty hosting my React App on an Amazon Lightsail LAMP instance. I have two versions of an htaccess file. One works for me when I host my React App on GoDaddy cPanel webhosting. I found the other online while trying to get the routing working.

This is the one that works on Godaddy:

RewriteEngine On 
RewriteBase /
  RewriteRule ^index\.html$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]

This is the one I found online:

Options +FollowSymLinks -MultiViews
  RewriteEngine On
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^ index.html [QSA,L]

I am starting to think it is somet9ing to do with the LAMP configuation on Lightsail. Any help on this would be much appreciated.



Related Questions



Can I use elastic beanstalk if I am a lightsail user?

Updated January 28, 2019 06:00 AM

Lightsail Domain Times Out

Updated July 11, 2019 01:00 AM

AWS Lightsail domain unreachable

Updated June 25, 2017 16:00 PM