erikras / erikras/react-redux-universal-hot-example

How do I do a permanent 301 redirect asynchronously after fetching data from the api

Open
#1,243 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
12.1k
Forks
2.5k
PR merge metrics
No merged PRs in 30d

Description

My site is a rebuild and I need to put permanent '301' redirects in place after fetching some data.

EG. user requests `/oldurl/old-reference`.

This is routed to a component for handling it. I use asyncConnect to make a call to the API through redux. When this returns I need to make a 301 redirect to the new url: `newurl/new-reference-from-api`. How do I communicate this back up to `server.js` after redux receives the data?

All this needs to happen in the initial server side rendering. The old urls are only accessed from external locations such as search engines.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.