Trailing slash option in next.config.js adds an extra trailing slash in /_next/image// path
Unanswered
Belgian Hare posted this in #help-forum
Belgian HareOP
In my next.config.js file I have the trailingSlash: true option set. This works as expected as all my site's paths include a trailing-slash and those without one are redirected to a path with a trailing slash.
There's unexpected behavior as it is also adding a trailing slash in my next/image URL path: [site].com/_next/image//?url=image.jpg
which is causing an unwanted redirect to:
[site].com/_next/image/?url=image.jpg
The extra slash on /_next/image/ is removed if I turn off trailing slashes:
[site].com/_next/image?url=image.jpg
For SEO purposes I can't set trailingSlash to false. Is there a way to get around this extra trailing slash? I'm on next v12 and using Image from next/image.
There's unexpected behavior as it is also adding a trailing slash in my next/image URL path: [site].com/_next/image//?url=image.jpg
which is causing an unwanted redirect to:
[site].com/_next/image/?url=image.jpg
The extra slash on /_next/image/ is removed if I turn off trailing slashes:
[site].com/_next/image?url=image.jpg
For SEO purposes I can't set trailingSlash to false. Is there a way to get around this extra trailing slash? I'm on next v12 and using Image from next/image.