Skip to content

Always redirect from page A to page B #13662

Answered by jamesmosier
sanderkooger asked this question in Help
Discussion options

You must be logged in to vote

One way to do it within Next would be to add this to your pages/library.js (or more likely pages/library/index.js):

export async function getServerSideProps(context) {
  context.res.writeHead(302, {
    Location: '/library/catwalks',
  });

  context.res.end();

  return {
    props: {}, 
  };
}

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by jamesmosier
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants