# 斜杠 url

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.jsand add the trailingSlashconfig:

module.exports = {
  trailingSlash: true,
}

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

Introduction to next.config.jsLearn more about the configuration file used by Next.js.

Last Updated: 5/13/2023, 8:55:38 PM