Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Append / to pathnames when in a subdir #208

Closed
mikecardwell opened this issue Nov 5, 2016 · 3 comments
Closed

Append / to pathnames when in a subdir #208

mikecardwell opened this issue Nov 5, 2016 · 3 comments

Comments

@mikecardwell
Copy link

If "pages/foo/index.js" exists, and there is also no "pages/foo.js", I would expect requests for "/foo" to be redirected to "/foo/" first before rendering "pages/foo/index.js". I think doing it the way I described is much more common than the way next is currently doing it.

@nkzawa
Copy link
Contributor

nkzawa commented Nov 5, 2016

Thanks for the proposal, but can you explain what is the benefit of redirecting to /foo/ urls ?

@mikecardwell
Copy link
Author

/foo and /foo/ are two different URLs. At the moment you're serving up the same content for both. It is bad for SEO and analytics if you have different URLs for the same content. It also breaks content fetched using relative paths. I.e you have an IMG tag with SRC="foo.jpg" ... That points to two different places whether you are on /foo/ or /foo. It's best to force a single URL as users do silly things like typing in URLs and adding or missing slashes and get confused when they see half broken content

@nkzawa
Copy link
Contributor

nkzawa commented Nov 14, 2016

Make sense but I think this shouldn't be default. (express also doesn't work like this)
You will be able to implement this behavior if you need by #25 .

@nkzawa nkzawa closed this as completed Nov 14, 2016
@lock lock bot locked as resolved and limited conversation to collaborators May 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants