我已经启用
locationProvider.HTML5mode(true);
然后我把top of index.html:
<html ng-app="app">
<head>
<base href="/projects/www/#/" />
所以如果我使用内部链接浏览网站,例如(#/users),一切都工作,url从projects/www/#/users
重写为projects/www/users
但是如果我直接通过浏览器进入projects/www/users
,我得到的页面没有找到。
唯一有效的直接url是:
projects/www/
这可能是什么?
我修复了它是添加一些服务器端htaccess代码:
RewriteEngine on
RewriteBase /Projects/www
# 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]