Bernard
Bernard

Reputation: 1623

web apache redirect request to index.html

I have built a site with Flutter Web that has generated a single-page app. It is deployed on the server and works fine (https://www.tg1s.com).

But, I need to access some "pages" directly via the Url. In order to do that I need to redirect all requests to index.html.

I tried with a .htaccess file placed beside the index.html file with the following code:

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

Then, I refresh my page (that was working fine) and I receive an error "500 Internal server error". I also tried several variation of the code but always with the same result. The site is hosted by OVH. Thanks for your help !

Upvotes: 0

Views: 507

Answers (1)

Bernard
Bernard

Reputation: 1623

Problem solved ! The error came from the text editor used to write the .htaccess file. I used TextEdit (macOs) and the resulting file was bugged. I tried with Atom and it works fine.

Upvotes: 0

Related Questions