Pro*_*tay 2 firebase next.js vercel
我之前曾在 firebase 上托管过我的网站,网址为:https: //oldurl.firebaseapp.com/ ,并且该应用程序已过时。
最近,我更新了应用程序并决定尝试 Vercel 并在此 URL 上创建了我的网站实例: https: //newurl.now.sh/
现在我不希望用户转到以前的 Firebase 域并查看过时的应用程序。我想要的是将用户从 firebase 域重定向到新的 Vercel 域。
假设当用户访问此 URL https://oldurl.firebaseapp.com/时,我想将他们重定向到此 URL: https: //newurl.now.sh/
我怎么做?
如果您想在用户进入您的网站时将其重定向到新 URL,请编辑您的项目firebase.json文件,如下所示:
{
"hosting": {
"public": "build", //whatever your public directory is
"redirects": [
{
"source": "/",
"destination": "https://mynewurl.now.sh/",
"type": 301
}
]
}
}
Run Code Online (Sandbox Code Playgroud)
然后部署
我从 google firebase 小组找到了这个解决方案
有关托管配置的更多信息,请访问https://firebase.google.com/docs/hosting。配置重定向部分介绍了重写(如代码片段)。
| 归档时间: |
|
| 查看次数: |
5055 次 |
| 最近记录: |