Nextjs should have more options for trailing slash.
See original GitHub issueFeature request
Is your feature request related to a problem? Please describe.
Nuxtjs have several options to choose trailing slash. (undefined, true, false) nuxt-community/nuxt-i18n#422
Describe the solution you’d like
Nextjs should have more options for trailing slash.
If use undefined
Nextjs should not redirect route when use URL that ends with a slash
trailingSlashes: true
/abc/ -> /abc/ (keeps the same) /abc -> /abc/ (changes)
trailingSlashes: false
/abc -> /abc (keeps the same) /abc/ -> /abc (changes)
trailingSlashes: undefined (default)
/abc/ -> /abc/ (keeps the same) /abc -> /abc (keeps the same)
Issue Analytics
- State:
- Created 3 years ago
- Reactions:50
- Comments:27 (12 by maintainers)
Top Results From Across the Web
Nextjs should have more options for trailing slash. #23988
Nextjs should have more options for trailing slash. If use undefined Nextjs should not redirect route when use URL that ends with a...
Read more >Trailing Slash - next.config.js
By default Next.js will redirect urls with trailing slashes to their counterpart without a trailing slash. For example /about/ will redirect to /about...
Read more >How can you handle trailing slashes in next.js routes?
This will ensure that all routes that end with a trailing slash are redirected to the non-trailing slash path via a 301 redirect....
Read more >How to Add Trailing Slash in NextJS Routes
In NextJS default configuration, the framework will remove the last slash in your route also called the trailing slash.
Read more >Trailing Slash vs No Trailing Slash – Whats Better for SEO?
When it comes to trailing slashes, some are for them, and some are against them. A trailing slash is the slash on the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think not being forced to opt-in into automatic trailingSlash url normalisation would be very helpful. My team wanted to upgrade to latest version of Next.js recently but this change keeps us from doing so.
Our use-case is international website that does not use trailing slashes at the end of the url except for home pages for different countries:
/gb-en/
<- home page/
/gb-en/page-1
<- page-1/page-1
We would benefit from
trailingSlashes: undefined (default)
On second thought, keep it simple, let’s just add an option to disable redirects.
This way we have a quick implementation time and we can implement a more complex solution later. Also, there are other ways to implement redirects (custom app, webserver in front of next, …) (I personally do all redirecting with apache or nginx, so I don’t actually want apps to do those themselves)