-1

I want to redirect all other url's to the default basename url: Eg:

<Router basename="test">
  <Routes>
   ......
  </Route>
  </Router>

If i hit the url /any it should redirect to /test, how to configure this in react router,I know that default route is not an option because url doesn't start with /test in this case?

1 Answers1

0

To define the default not found route don't use path:

<Router basename="test">
    <Switch>
      ...
      <Route component={NotFound}/>
    </Switch>
</Router>
MaK
  • 121
  • 1
  • 8