问题描述:
laravel框架在路由设置里的web.php文件新增一个路由(如下图1),如果nginx里没有做任何配置,那么在访问新增路由时。url地址需要携带index.php+新增的路由(既:http://www.laraveldev.com/index.php/goods)
如下图1:
如果要在项目的URL中省去index.php 需做如下配置
在vhosts文件夹下当前项目的配置文件中添加以下代码重启就OK了
方法一:
location / {
try_files $uri $uri/ /index.php?$query_string;
}
方法二:
if (!-e $request_filename) {
rewrite ^/(.*) /index.php/$1 last;
}
如图下图: