Skip to content

Latest commit

 

History

History
35 lines (25 loc) · 1010 Bytes

trailing-slash.md

File metadata and controls

35 lines (25 loc) · 1010 Bytes
description
Configure Next.js pages to resolve with or without a trailing slash.

Trailing Slash

Version History
Version Changes
v9.5.0 Trailing Slash added.

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:

module.exports = {
  trailingSlash: true,
}

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

Related