How do I exclude a path (/images) from single page app rewrite?

拟墨画扇 提交于 2019-12-06 02:39:14

I'm a bit late but I found this question while searching for a similar problem.

Use this rewrites rule :

"rewrites": [
  {
    "source": "!/images/**",
    "destination": "/index.html"
  }
]

The key is that "source" (as a lot of fields in firebase.json) use a glob pattern matching notation. Instead of redirecting everything on index.html (as do " ** "), this rule redirect everything that is not in the images folder and subfolders.

"hosting": {
  "rewrites": [
    {
      "source": "/images/**",
      "destination": "/something.html"
    },
    {
      "source": "**",
      "destination": "/index.html"
    }
  ]
}

This will exclude everything inside your /images folder rewriting it to /something.html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!