【发布时间】:2016-05-05 08:54:37
【问题描述】:
我正在使用带有 Angular 的 Laravel 5。
默认情况下,Angular 将 /#/ 添加到 URL。
我不喜欢 /#/,所以我使用 Angular 中的 $locationProvider.html5Mode(true); 将其删除。
现在每当我尝试访问 Angular URL 时,Laravel 拒绝重定向我,而是导致错误 NotFoundHttpException 说:
抱歉,找不到您要查找的页面。
RouteCollection.php 第 161 行中的 NotFoundHttpException:
这是非常合乎逻辑的,因为 Laravel 的路由文件中没有定义路由。
如何解决这个问题?!
更多详情:
- 当我访问
http://whatever.app/#/dashboard/home时,一切正常(laravel 知道它是 Angular 路由,然后 Angular 去掉了 # 所以 URL 变为http://whatever.app/dashboard/home没有错误)。 - 当我访问
http://whatever.app/dashboard/homeLaravel 时显示错误NotFoundHttpException。
【问题讨论】:
标签: angularjs laravel laravel-5 laravel-5.1 laravel-routing