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.


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.

  • Either should work. You need to check your Apache error logs. Commented Aug 14, 2019 at 4:19
  • @MichaelHampton I have just checked and there are no errors. It seams taht the htaccess file is not running. I have it stored in htdocs (where my app is) is this right?
    – Chris
    Commented Aug 14, 2019 at 4:30

1 Answer 1


To get better understanding can we get an idea of where you are and where you want to be (Redirect) either non-existing pages to index.php or any other.

Try the same in .htaccess

RewriteEngine On

RewriteBase /

RewriteRule ^index.php$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /index.php [L]

You can have better control over the processing versus creating different handler files and having apache capture the data and give it to the appropriate handler or variable ID

And check the apache configuration -> /etc/httpd/conf/httpd.conf

 Options Indexes FollowSymLinks

 AllowOverride all

 Order allow,deny

 Allow from all

  • I have updated my question with where I am currently at.
    – Chris
    Commented Aug 14, 2019 at 23:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .