Next.js Discord

Discord Forum

Exclude admin routes from rewriting host

Unanswered
Cuban Crocodile posted this in #help-forum
Open in Discord
Cuban CrocodileOP
I do:
async rewrites() {
return [
{
has: [
{
type: 'host',
value: '(?<host>.)',
},
],
source: '/',
destination: '/:host',
},
{
has: [
{
type: 'host',
value: '(?<host>.
)',
},
],
source: '/:path',
destination: '/:host/:path
',
},
];
},

I do a multitenant project. And in pages root, i have [...slug].tsx, i dont have main index.tsx
How do i exclude 'admin' routes from here? I want to be able to manage /admin/products/[productId] pages with its own routes, but now, they are all catched by catch all route

0 Replies