How to exclude trailing slash in a single route in Next.js?

Viewed 1307

I have a problem with Next.js Trailing Slash on some pages, I am using media query like:

/test?type=something

but with a trailing slash, I am getting

/test/?type=something

Is there any solution to remove the trailing slash on some specific pages?

1 Answers

currently, You can only set the behavior for all pages.

according to the Next.js documentation:

Open next.config.js and config the trailingSlash:

module.exports = {
  trailingSlash: true/flase,
}
Related