I’ve been trying to set up redirects for our documentation site using placeholders
Our documentation site has the format of
<domain>/docs/<version>/page
For example, I want to redirect all versions of page
to a specific some-new-page
/docs/:version/page /docs/some-new-page
This is not working because our site uses versions with periods.
For example
reactnative.dev/docs/0.72/page
The above does not match the rule because “0.72” isn’t captured by :version
.
I’ve verified this by testing reactnative.dev/docs/072/page
which does successfully redirect.
Here is the PR where I’m adding these redirects: Rework the New Architecture Section by lunaleaps · Pull Request #3998 · facebook/react-native-website · GitHub
Here is the deploy for that PR: https://deploy-preview-3998--react-native.netlify.app/
You can verify that
https://deploy-preview-3998--react-native.netlify.app/docs/123/the-new-architecture/use-app-template
successfully redirects but
https://deploy-preview-3998--react-native.netlify.app/docs/0.72/the-new-architecture/use-app-template
does not.
The deploy preview is still up. Sorry those links probably work now because I’ve worked around the issue by explicitly listing out the versions.
See this commit: Rework the New Architecture Section by lunaleaps · Pull Request #3998 · facebook/react-native-website · GitHub
Here, let me add back a redirect to consistently test
@lunaleaps Those rules wouldn’t have accounted for 0.73
redirecting correctly.
They also weren’t my first/only test, just the ones I settled on to best demonstrate what I was seeing.
Makes sense, I had wondered what $LATEST_VERSION would resolve to.
However I’m fairly certain (but could be mistaken) that I tested combinations outside of your version range, and I did notice the behavior rather drastically change right before I posted (presumably when you pushed the adjusted _redirects
).
Let me know once there’s a named placeholder there again.
Sorry, I’m a little confused. Could you please explain what part exactly is not working? Based on the shared commit, I can see /docs/0.66/architecture-overview
works fine: Architecture Overview · React Native and so does: https://deploy-preview-3998--react-native.netlify.app/docs/0.73.