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

(docs) URLs with trailing slashes #672

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

developit
Copy link
Member

It looks like Netlify automatically redirects to URLs with trailing slashes (go to wmr.dev/docs, then reload). I'm not sure if there's a way to turn that off on the Netlify side? If not, we can just generate them with trailing slashes to match.

It looks like Netlify automatically redirects to URLs with trailing slashes (go to `wmr.dev/docs`, then reload). I'm not sure if there's a way to turn that off on the Netlify side? If not, we can just generate them with trailing slashes to match.
@changeset-bot
Copy link

changeset-bot bot commented Jun 7, 2021

⚠️ No Changeset found

Latest commit: 0eb75a3

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Member

@marvinhagemeister marvinhagemeister left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On second thought: Maybe the trailing url thing is something we should deal with in our router instead? Most other ones seem to do it and that's a much more generic solution rather than tying the url structure to a specific hosting provider.

@developit
Copy link
Member Author

developit commented Jun 7, 2021

What do you mean by dealing with it in the router? Something like a config for "add trailing slash"? (would have to be a regex to prevent it being appended to index.html/)

@marvinhagemeister
Copy link
Member

Nah, rather that the regex is more loose and matches both with and without trailing slashes for the same route.

/blog/:id -> /blog/post-a  = match
          -> /blog/post-a/ = match

(Might be misunderstanding the issue at hand when it comes to netlify)

@zgoda
Copy link

zgoda commented Aug 27, 2021

It seems you can only force URL normalisation, not turn it off. See https://docs.netlify.com/routing/redirects/redirect-options/#trailing-slash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants