如何将hashbang url更改为历史API [英] How to change hashbang url to history API

查看:101
本文介绍了如何将hashbang url更改为历史API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用ember1.0-rc3,我想将hashbang urls更改为普通的url格式(即www.site.com/admin#/page1到www.site.com/admin/page1).In order为了做这个改变,我使用位置:应用程序路由器中的历史。

I'm using ember1.0-rc3, i want to change hashbang urls into normal url format (ie, www.site.com/admin#/page1 to www.site.com/admin/page1).In order to make this change,i use location: "history" in app router.

但是当我重新加载页面或书签时,页面不起作用,它会重定向到home我想要在我的应用程序中重新加载和书签,而不改变.htaccess文件中的重定向网址。有什么办法吗?谢谢提前

But when i reload a page or bookmark a page doesn't works, it redirects to home page only.I want the options reload and bookmark in my app, without changing redirect urls in .htaccess file.Is there any way for it?Thanks in advance

推荐答案

为了使用单个页面应用程序(如ember)使用HTML5历史记录,您的服务器必须具有为任何URL呈现主要的index.html文件的行为。 Ember路由器在加载并查看正确路由时具有查看URL的逻辑。

In order to use HTML5 history with a single page app like ember, your server must be have the behavior of rendering your main index.html file for any URL. The Ember router has the logic to look at the URL when it loads and go to the correct route.

这篇关于如何将hashbang url更改为历史API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆