301 Redirects in Next.js without passing the query from source URL to destination URL
Есть source-URL вида
https://example.com/category/results/refine?dealers=123&inv=true&sellertypes=dealerХочется перманентно (301) редиректить этот source-URL на destination-URL вида
https://example.com/при условии если source-URL в query содержит ключиdealers(любые) иinv(в значении true).В соответствии с документацией Next.js реализовал следующее в
next.config.ts:async redirects() { return [ { source: "/category/results/refine", has: [ { type: "query", key: "dealers", }, { type: "query", key: "inv", value: "true", }, ], destination: "/", permanent: true, statusCode: 301, }, }Но вместо редиректа на
https://example.com/получаю редирект наhttps://example.com/?dealers=123&inv=true&sellertypes=dealer. То есть query из source-URL приклеивается к destination-URL, а мне надо чтобы последний был без query.