Skip to content

Can't redirect the path "*" to the basepath #9928

Closed Answered by ithilbor
ithilbor asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, to get the same result of the basepath what I've done is this:

Into the index.tsx file:

      <BrowserRouter>
          <Routes>
             <Route path="*" element={<MyApp />} />
          </Routes>
      </BrowserRouter>

Into the MyApp.tsx file:

      <Routes>
        <Route path={urlPrefix}>
          <Route element={<ProtectedRoutes />} >
            <Route path="/home" element={<Home />} />
            <Route path="/test" element={<Test />} />
            <Route path="/help" element={<About />} />
          </Route>
        </Route>
       <Route path="*" element={<DefaultRoute />} />
     </Routes>

Where the urlPrefix was my initial basepath

Replies: 7 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@ithilbor
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by ithilbor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants