使用 React 和 Google Hosting,如何重定向以 /posts/### 结尾的所有链接,其中 ### 是任何帖子 ID

问题描述

我有一个 React 站点,该站点已设置并用于将深层链接共享到我的 React Native 应用程序中。这一切都按预期工作,但我正在尝试将未安装该应用程序的人重定向到应用程序商店/Play 商店。

我用于深层链接的网址如下:

https://example.com/posts/###

有没有办法定位所有以 /posts/### 结尾的 URL 并在末尾使用通配符?

托管在 firebase 上,使用 React 构建。

谢谢!

解决方法

使用 using editable popups rendered from a dynamic state array 我能够解决问题!

// example
<Router>
  <Switch>
    <Redirect from="/posts/*" to="/getApp" />
    <Route exact path="/getApp" component={GetAppScreen} />
    <Route exact path="/contact" component={ContactScreen} />
     ...
  </Switch>
</Router>