情况是这样的,刚安装了 laravel,然后用 nginx 配置了 url 的重写
#location / {
# index index.php index.html index.htm;
# try_files $uri $uri/ /index.php?$query_string;
#}
然后配置了 laravel 的路由:
Route::get('/ex/am',function(){
return 'hello laravel';
});
此时输入 http://localhost/ex/am 是显示 hello laravel 的
然后我把 nginx 的重写注释掉,在浏览器输入:
http://localhost/index.php/ex/am 显示 not found
http://localhost/inde.php?/ex/am 也是 not found
重新开启 nginx 重写后又能正常访问
所以,我想知道为什么不开启重写,直接访问以上两个地址之一没法正常显示 hello laravel ??
试过看源码,有点绕。。。所以来这边问一下
#location / {
# index index.php index.html index.htm;
# try_files $uri $uri/ /index.php?$query_string;
#}
然后配置了 laravel 的路由:
Route::get('/ex/am',function(){
return 'hello laravel';
});
此时输入 http://localhost/ex/am 是显示 hello laravel 的
然后我把 nginx 的重写注释掉,在浏览器输入:
http://localhost/index.php/ex/am 显示 not found
http://localhost/inde.php?/ex/am 也是 not found
重新开启 nginx 重写后又能正常访问
所以,我想知道为什么不开启重写,直接访问以上两个地址之一没法正常显示 hello laravel ??
试过看源码,有点绕。。。所以来这边问一下
