我在我的angular应用中使用HTML5模式来关闭hashbang,这是因为我将为我的用户提供URL,如下所示:
http://myapp.com/nicklewis
而不是:
http://myapp.com#/nicklewis
后者可以工作,但对于虚荣的URL来说并不理想。
所以,除了编写我自己的NodeJS应用程序来解决这个问题之外,在Firebase中有什么我可以使用的吗?
发布于 2014-08-17 01:39:17
Firebase刚刚有了一个包含此功能的最新更新。你可以这样在你的firebase.json中使用它:
"rewrites": [ {
"source": "**",
"destination": "/index.html"
} ]这是他们的文档中使用的代码示例,它会将未找到的任何目录或文件发送回index.html。
需要注意的是,您需要将firebase部署工具更新到version 1.1.0 or higher才能正常工作:
$ npm update -g firebase-tools根据您的权限,您可能需要对此使用'sudo‘。
您可以在此处阅读文档:https://www.firebase.com/docs/hosting/guide/url-redirects-rewrites.html
您可以在此处阅读有关更新firebase工具的信息:https://www.firebase.com/docs/hosting/guide/command-line-tool.html
https://stackoverflow.com/questions/24206362
复制相似问题