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

Add universal redirect example #1237

Closed

Conversation

timneutkens
Copy link
Member

No description provided.

@sedubois
Copy link
Contributor

Would be nice to have a deployment on now to see how it behaves 😊

@timneutkens
Copy link
Member Author

@sedubois great idea, done 🙌

@@ -0,0 +1,19 @@
import React from 'react'
import ErrorComponent from 'next/error'
import redirect from 'next-universal-redirect'
Copy link
Contributor

Choose a reason for hiding this comment

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

Shall we make this open? I can't see the source.
See: https://github.com/timneutkens/next-redirect

Copy link
Member Author

Choose a reason for hiding this comment

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

https://github.com/timneutkens/next-universal-redirect seems like the package.json should be updated. Good catch!

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed 🙌

@sedubois
Copy link
Contributor

What about https://github.com/matthewmueller/next-redirect by @matthewmueller?

@sergiodxa
Copy link
Contributor

I think next-redirect is easier to use than next-universal-redirect, is just a function you call in getInitialProps, you don't need a HOC and create a Map instance, just call a simple function 🤔

@timneutkens
Copy link
Member Author

@sergiodxa it serves a different purpose. This one is for lists of redirects from non-existent pages to existent (well, if you screw up non-existent) pages. Next-redirect is for a more for redirecting when stuff happens. Also, next-redirect is not universal but only server side.

@matthewmueller
Copy link
Contributor

next-redirect is not universal but only server side.

actually it works on both: https://github.com/matthewmueller/next-redirect/blob/master/index.js#L16

@timneutkens
Copy link
Member Author

@matthewmueller ah, right, I meant it doesn't use next/router 😄

@timneutkens timneutkens deleted the add-universal-redirect-example branch February 26, 2017 17:46
@lock lock bot locked as resolved and limited conversation to collaborators Jan 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants