【发布时间】:2016-01-16 05:38:45
【问题描述】:
在 public/index.php 中,我已将 $app->run() 更改为 $app->run($app['request']),这导致 Lumen 在子文件夹中工作,所以这样可以:
http://local.dev/app/
http://local.dev/app/test
但是,如果路线末尾有斜线,那么我会得到 NotFoundHttpException。例如:
http://local.dev/app/test/
我正在使用 NGINX,我对文件夹的重写规则是:
location /app/ {
try_files $uri $uri/ /app/index.php?$query_string;
}
我做错了吗?
【问题讨论】:
-
如果你从 nginx 配置中删除尾部斜杠怎么样。阅读this article 了解更多信息?
-
根据 Lumen
.htaccess,和 Laravel 一样,尾部的斜线意味着被剥离。这里不是 nginx 用户,但你应该可以在那里做同样的事情。