设置路由名就无法访问,出现404错误
在nginx里加上如下rewrite代码:
location / {
try_files $uri $uri/ /index.php?$query_string;
}
if (!-d $request_filename)
{
rewrite ^/(.+)/$ /$1 permanent;
}
# 去除index action
if ($request_uri ~* index/?$)
{
rewrite ^/(.*)/index/?$ /$1 permanent;
}
# 根据laravel规则进行url重写
if (!-e $request_filename)
{
rewrite ^/(.*)$ /index.php?/$1 last;
break;
}
#error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}