我有一个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;
}
}
答案 0 :(得分:0)
我认为Rickard Smith可能是对的!!以下是最终代码
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9006;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors off;
fastcgi_buffer_size 16k;
fastcgi_buffers 4 16k;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
}
然后你现在可以使用路径组前缀和“点”,谢谢Rickard Smith和shempignon帮助!!