【发布时间】:2016-07-29 16:03:53
【问题描述】:
我有一个 Laravel 5 项目,可以从 testing.com/staffs 访问人员信息,但我想将 URL 更改为 testing.com/test/index.php/staffs,我尝试了 Laravel Route 组使用“test/index.php/”,但是laravel不支持路由中的“dot”,我该怎么做?
以下是我的部分 nginx.conf
location / {
try_files $uri $uri/ /index.php?$args;
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
expires max;
}
location ~ [^/]\.php(/|$) {
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_pass 127.0.0.1:9006;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
}
}
【问题讨论】:
-
您似乎缺少
fastcgi_split_path_info ^(.+?\.php)(/.*)$;。见this document。 -
您是否尝试为您的路线添加前缀?
Route::group(['prefix' => 'test/index.php'], function() { /* your route here ... */ }); -
shempignon : Laravel 不支持 dot in route::group 前缀
标签: php codeigniter laravel nginx