I am trying to upload my application to Plesk and it is working fine except when i try to render non .HTML page component for example it through error 404 page not found I understand this related to the server but I don`t know how to fix it.
I have uploaded the same application on Vercel and it is working fine on all pages and components.
<Route exact path="/" render={() => {window.location.href="Home.html"}} />
<Route path="/quiz" component={App} />
<Route path="/questions" render={() => {window.location.href="questions.html"}} />
<Route path="/profile" render={() => {window.location.href="profile.html"}} />
<Route path="/about" render={() => {window.location.href="about.html"}} />
As u can see most of my routes are to .HTML pages and they are all working when i visit domain/quiz i get 404 page not found.
I would appreciate if there is a fix for that.
And i have already tried to create the .htaccess as recommended in many previous solutions but it did not solve the problem.
2
Answers
The solution suggested by this https://stackoverflow.com/a/60342849/7345217 worked
Create a .htaccess file in the Public folder of your React App.
Put these lines in the file
Save and (npm react or yarn build) and it should work
In my case i create a .htaccess file in the Public folder of your React App.
Put these lines in the file
and create a _redirects file in the Public folder of your React App.
Put this lines in the file
also create web.config in plesk hosting folder where build is uploaded and wrote
and it works..!