首页 > 解决方案 > Firebase 托管重写无法正常工作

问题描述

我目前有以下配置:

// firebase.json   
{
        "hosting": [
            {
                "rewrites": [{
                    "source": "/articles{,/**}",
                    "destination": "/articles"
                },
                {
                    "source": "**",
                    "destination": "/index.html"
                }]
            }
        ]
 }

如果我去mysite.com/articles/<articleID>mysite.com会被带到我期望被带到的时候mysite.com/articles。我做错了什么?

我正在关注这个文档。

标签: firebaseurl-rewritingfirebase-hosting

解决方案


采取以下步骤后,我能够解决问题:

  1. 将我的来源更改/articles{,/**}/articles/**
  2. Change my destination from articles to articles.html which is a valid local file
  3. Realize that changes to firebase.json don't change the behavior of the Firebase Hosting emulator until it is restarted.

推荐阅读