Skip to content
Important
Security Advisory: CVE-2025-66478
Find out more
You are currently viewing documentation for version 13 of Next.js.

trailingSlash

Last updated June 28, 2023

By default Next.js will redirect urls with trailing slashes to their counterpart without a trailing slash. For example /about/ will redirect to /about. You can configure this behavior to act the opposite way, where urls without trailing slashes are redirected to their counterparts with trailing slashes.

Open next.config.js and add the trailingSlash config:

next.config.js
module.exports = {
  trailingSlash: true,
}

With this option set, urls like /about will redirect to /about/.

Version History

VersionChanges
v9.5.0trailingSlash added.

Was this helpful?

supported.