I have a single landing page nextJs
application it is possible to redirect all *
to specific routes as we do in react-router
like this how can I do exactly the same in nextJs
<BrowserRouter>
<Routes>
<Route path={ROUTES.ROOT} element={<Registry />} />
<Route path={ROUTES.ALL} element={<Navigate to={ROUTES.ROOT} />} />
</Routes>
</BrowserRouter>
export const ROUTES = {
ALL: '*',
ROOT: '/registry',
};
what I have done so far is that I'm able to redirect a specific route to specific route but not able to redirect all routes to a specific route
const nextConfig = {
async redirects() {
return [
{
source: '/path', // not able to "*" the route
destination: '/registry', // Matched parameters can be used in the destination
permanent: false,
},
];
},
};
module.exports = nextConfig;