Search code examples
javascriptreactjsproductionfilezilla

Problem when my React App is put on the web


I have created my React App, npm run build ... Put my file in filezilla, but the problem is that I have this error

Not Found
The requested URL /main was not found on this server.

when I go to a page other than https://clickswinner.alwaysdata.net

What are you propose ?


Solution

  • Try creating a .htaccess file and put it at root of your server

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