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.
EDIT 1:
As requested by Aiden:
I am in currently trying to migrate from GoDaddy cPanel Web Hosting to an Amazon Lightsail instance running LAMP. My web app has been created using React
. The .htaccess
file is supposed to redirect the client to index.html
which is where the new content will be loaded by the JS. My .htaccess
file works with GoDaddy but not on the Lightsail instance. I am assuming it is a configuration issue in LAMP. I have tried setting what was suggested by Aiden to no avail. My .htaccess
file is in the htdocs
folder.