Angularjs HTML5模式在angular中不工作
在教程之后尝试使用HTML5模式。我所做的事情-Angularjs HTML5模式在angular中不工作,angularjs,apache,Angularjs,Apache,在教程之后尝试使用HTML5模式。我所做的事情- app.js的配置关闭 $locationProvider.html5Mode(true) index.html的内部头标记。在test.com中部署应用程序 在apache vhost conf中重写配置 重新启动发动机 #如果请求了现有资产或目录,请按原样转到该资产或目录 RewriteCond%{DOCUMENT_ROOT}%{REQUEST_URI}-f[或] 重写cond%{DOCUMENT\u ROOT}%{REQUEST\u U
app.js的配置关闭
$locationProvider.html5Mode(true)代码>
test.com中部署应用程序
重新启动发动机
#如果请求了现有资产或目录,请按原样转到该资产或目录
RewriteCond%{DOCUMENT_ROOT}%{REQUEST_URI}-f[或]
重写cond%{DOCUMENT\u ROOT}%{REQUEST\u URI}-d
重写规则^-[L]
#如果请求的资源不存在,请使用index.html
重写规则^/index.html
结果:当我访问suburl时-
test.com/dashboard
它正在重定向到test.com
test.com/#/dashboard
url已变形为test.com/#%2Fdashboard
。当我点击refresh时,它重定向回test.com
.config(['$routeProvider','$httpProvider','$locationProvider',
function($routeProvider, $httpProvider, $locationProvider) {
$tu="templates/";
$routeProvider
.when("/", { templateUrl:$tu+'home/index.html' })
.when("/dashboard", {templateUrl:$tu+'dashboard/index.html'})
.when("/notes", {templateUrl:$tu+'notes/index.html'})
$httpProvider.defaults.withCredentials = true;
$locationProvider.html5Mode(true);
}])
我也阅读了文档和其他教程,但未能完全理解。请帮帮我 用您提供的一点点代码来解决这个问题有点困难。路由设置的准确程度如何?@JonBlack添加了路由的详细信息。您是否可以显示整个配置设置?这些零零碎碎的东西仍然不能让我了解整个情况。用你提供的一点点代码来解决这个问题有点困难。路由设置的准确程度如何?@JonBlack添加了路由的详细信息。您是否可以显示整个配置设置?这些零碎的东西还不能让我了解全部情况。