How to redirect a page that no longer exists with expo-router with Universal links / deep links?

I have a universal link / deep link (ie: https://myapp.com/share/blog/43) which I would like to redirect to another page (ie: https://myapp.com/post/43) within a ‘expo-router’ based react native app.

If I click on the old link that no longer has an expo-router folder structure within the project (ie: https://myapp.com/share/blog/43).

Expo outputs an error:

The navigation state parsed from the URL contains routes not present in the root navigator. This usually means that the linking configuration doesn’t match the navigation structure. See https://reactnavigation.org/docs/configuring-links for more details on how to specify a linking configuration.

This error seems to be related to react-navigation and not expo-router. There does not seem to be an equivalent solution for expo-router.

I don’t want to have to keep the old expo-router folder paths just to support this old url.

Leave a Comment