角1.3.15 html5mode deeplinking,路线,哈希 [英] angular 1.3.15 html5mode deeplinking, route, hash

查看:163
本文介绍了角1.3.15 html5mode deeplinking,路线,哈希的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我启用html5mode 真正,放在<基本href =/> head标签内。这似乎是工作的罚款。但是,当我刷新页面,它给了我一个错误。

I enabled html5mode true and placed <base href="/"> inside head tag. It seems to be working fine. But when I refresh a page, it gives me an error.

The requested URL /updated_1/work was not found on this server. 

在另一篇文章发现这一点。

Found this in another post.

此问题是由于使用AngularJS 1.1.5(这是不稳定的,而且显然有一些bug或者不同的实现路由比在1.0.7)

This problem was due to the use of AngularJS 1.1.5 (which was unstable, and obviously had some bug or different implementation of the routing than it was in 1.0.7)

立即将其返回到1.0.7解决了这个问题。

turning it back to 1.0.7 solved the problem instantly.

已经尝试了1.2.0rc1版本,但还没有完成测试,我不得不重写某些路由器功能,因为他们把它的核心。

have tried the 1.2.0rc1 version, but have not finished testing as I had to rewrite some of the router functionality since they took it out of the core.

反正,使用AngularJS VS 1.0.7当这个问题得到解决。

anyway, this problem is fixed when using AngularJS vs 1.0.7.

使用旧版本提供了更多的错误。所以,我虽然使用最新版本。我使用AngularJS v1.3.15。

Using old version gives more error. So I though to use latest version. I'm using AngularJS v1.3.15.

是,与棱角分明版中的问题?有些人能最好的解决方案建议。

Is that a problem with angular version? Can some one suggest with best solution.

感谢

推荐答案

您需要让页面直接链接,使他们能够通过角处理。如果你不这样做,当用户刷新,他们得到了一个空白屏幕。

You need to allow direct-linking of pages so they can be processed by Angular. If you don't do this, when the user refreshes, they get a blank screen.

创建文件夹内的.htaccess文件,并在此粘贴(假设你的主文件名为index.html)。

Create an .htaccess file inside your folder, and paste in this ( assuming your main file is named index.html ).

<ifModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !index
    RewriteRule (.*) index.html [L]
</ifModule>

如果问题仍然存在,让我知道。

If the problem still persist, let me know.

这篇关于角1.3.15 html5mode deeplinking,路线,哈希的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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