ember.js - 在 Github Pages 上的 Ember.js 中获取没有哈希的 url

我想去掉 url 中丑陋的哈希标签 (www.example.com/#/projects/id -> www.example.com/projects/id)。所以我加了

Router.reopen({
    location: 'history'
});

如果我将我的应用程序打开到根目录 www.example.com,然后单击一个链接,我就可以访问 www.example.com/projects 等。但是,如果我将 www.example.com/projects 放在我的网址栏中并以这种方式加载页面,我们会收到 404 错误。为什么会发生这种情况对我来说很有意义(毕竟,服务器只在一个 url 上提供 javascript Assets )。我正在为我的网站使用 github 页面,我应该使用什么方法来完成这项工作?

最佳答案

基本上,无论输入什么 url,您的服务器都需要为您的 index.html 文件提供服务。

Keep in mind that your server must serve the Ember app at all the routes defined here.

更多信息 the docs

https://stackoverflow.com/questions/23255689/

相关文章:

datomic - 将任意键/值条目与数据实体一起存储

angularjs - 关于Angular $q defer对象的问题

ruby-on-rails - 在 current_password 字段中设计更改验证消息

installation - NSIS:MUI_PAGE_INSTFILES 完成后如何自动按下 "

vb.net - MeasureText() - SizeF 到英寸

applescript - 如何使用 AppleScript 关闭 MS Office Ribbon

asp.net - 在 RDLC 报告 asp.net 中放置超链接

azure - WAStorageEmulator.exe 启动失败

scala - 修复更高种类类型的类型推断

maven - java.lang.IllegalStateException : Could no