I am getting a 404 error when refreshing the site on routes other then "/"
I am using symfony and react router.
I have added prioity into the route but this does not seem to help
This is the default controller
class DefaultController extends AbstractController{
/**
* @Route("/{reactRouting}", name="home", priority="-1" ,defaults={"reactRouting": null}, requirements={"reactRouting"=".+"})
*/
public function index()
{
return $this->render('default/index.html.twig');
}}
This is the Main.js file
import React from 'react';
import Home from "./src/Pages/Home.js"
import Components from "./src/Pages/Components";
import Contact from "./src/Pages/Contact";
import { BrowserRouter as Router, Routes, Route } from "react-router-dom";
const Main = () => {
return (
<div className='App overflow-clip'>
<Router>
<Routes>
<Route path='/' element={<Home />} />
<Route path='/components' element={<Components />} />
<Route path='/contact' element={<Contact />} />
</Routes>
</Router>
</div>
);
};
export default Main;
When i go to
http://dev.symfony-react.com/ - it works fine
then i click on a link on that page it will take be fine to
http://dev.symfony-react.com/contact
If i then refresh that page it returns a 404 error
Thanks in advance