Movatterモバイル変換


[0]ホーム

URL:


Skip to content

trailingSlash

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.

Opennext.config.js and add thetrailingSlash config:

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

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

When usingtrailingSlash: true, certain URLs are exceptions and will not have a trailing slash appended:

  • Static file URLs, such as files with extensions.
  • Any paths under.well-known/.

For example, the following URLs will remain unchanged:/file.txt,images/photos/picture.png, and.well-known/subfolder/config.json.

When used withoutput: "export" configuration, the/about page will output/about/index.html (instead of the default/about.html).

Version History

VersionChanges
v9.5.0trailingSlash added.

Was this helpful?

supported.

[8]ページ先頭

©2009-2025 Movatter.jp