0

我启用了

locationProvider.HTML5mode(true);

然后我把 index.html 放在上面:

<html ng-app="app">
<head>
 <base href="/projects/www/#/" />

因此,如果我使用内部链接浏览网站,例如(#/users),一切正常,并且 url 被重写projects/www/#/usersprojects/www/users

但是,如果我直接通过浏览器访问,则projects/www/users找不到页面。

唯一有效的直接网址是:

projects/www/

这可能是什么?

4

1 回答 1

0

好的,我修复它是添加一些服务器端 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]
于 2014-03-10T09:05:06.600 回答