【发布时间】:2019-01-22 20:36:07
【问题描述】:
我将我的 angular.js 项目转换为 html5mode 一切正常,直到我尝试刷新我的页面。我做了一些研究,发现它与服务器端有关。
我将<base href="/index.html"> 添加到我的 index.html 中,在所有内容之前。
然后将$locationProvider.html5Mode(true).hashPrefix('!'); 添加到我的应用配置中。
正如其他问题中所建议的那样,我将这些行添加到我的 .htaccess 中
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^(.*) /index.html [NC,L]
但我的问题还在继续。
我该怎么办?
【问题讨论】:
标签: angularjs apache .htaccess ngroute html5mode