NextJS router push remove slash

198 Views Asked by At

I want to add to the default page ( localhost:3000 ) url parameter, so I can read it in server component.

Like this:

http://localhost:3000?page=1

but instead I am getting this:

http://localhost:3000/?page=1

I have not been able to figure out how to remove the slash. This is the code I am using:

 router.push('?page=' + currentPage)  

This is my adjusted exports:

module.exports = {
    images: {
      remotePatterns: [
        {
          protocol: 'https',
          hostname: '...com',
          port: '',
          pathname: '/*',
        },
      ],
    },
    trailingSlash: false,
  }

I can get the parameter from the url even with the slash, but I would like to remove it if possible.

0

There are 0 best solutions below