下面是.htaccess文件我目前有:
Here is the .htaccess file I have currently:
RewriteEngine on
# Don't rewrite files or directories
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
# Rewrite everything else to index.html to allow html5 state links
RewriteRule ^ index.html [L]
它适用于网址是这样的:
It works for url's like this:
http://domain.com/view
http://domain.com/otherview
但是,如果我尝试做一个硬刷新的参数是这样的:
But if I try and do a hard refresh on parameters like this:
http://domain.com/view/3523
http://domain.com/view/1234/5322
如果我做硬刷新任何生成的参数的网页,它只是显示的index.html没有任何JavaScript加载,它打破了网页。
If I do a hard refresh on any parameter generated pages it just shows index.html without any Javascript loaded, which breaks the page.
参数的URL的工作,如果我浏览网页从应用程序内,否则他们不工作。
The parameter URL's work if I navigate to the page from within the app, otherwise they don't work.
我如何获取参数的URL的工作在AngularJS中的硬刷新。
How do I get parameter URL's to work on a hard refresh within AngularJS.
我也HTML5模式打开:
I also have HTML5 mode turned on:
$ locationProvider.html5Mode(真);
您可以使用下面的代替:
You can use the following instead:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [NC,L]
RewriteRule ^ index.html [NC,L]