Laravel的Nginx重写规则实例代码
laravel基本重写规则
location/{
indexindex.htmlindex.htmindex.php;
try_files$uri$uri//index.php?$query_string;
}
去除末尾的斜杠,SEO更加友好
if(!-d$request_filename)
{
rewrite^/(.+)/$/$1permanent;
}
去除indexaction
if($request_uri~*index/?$)
{
rewrite^/(.*)/index/?$/$1permanent;
}
根据laravel规则进行url重写
if(!-e$request_filename)
{
rewrite^/(.*)$/index.php?/$1last;
break;
}
错误信息跳转页面必须在location~\.php(.*)${}里面加入条:fastcgi_intercept_errorson开启错误检测信息
#nginx错误信息跳转自定义页面50x.html自己随便定义
error_page404500502503504error.html;
location=error.html{
roothtml;
}
root是error文件的根目录
总结
以上所述是小编给大家介绍的Laravel的Nginx重写规则实例代码,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对毛票票网站的支持!
热门推荐
10 朋友新年祝福语大全 简短
11 新年祝福语简短大方兔年
12 搬新家礼物祝福语简短
13 同学见面花束祝福语简短
14 五一假期祝福语幽默简短
15 离职欢送敬酒祝福语简短
16 对学弟的祝福语简短
17 考老师辞职祝福语简短
18 祝福语驱散霉运的话简短