nginx下开启tp5的路由

由于nginx不支持pathinfo,导致TP5用路由访问时会报404。

解决办法,找到nginx下虚拟主机的配置文件,一般是在/usr/ local/ nginx/ conf/ vhost/ 域名.conf

在中间加上一段代码

location / { 
	if (!-e $request_filename) {
		rewrite  ^(.*)$  /index.php?s=$1  last;
		break;
	}
}

nginx下ThinkPHP5.0路由无效

完美解决!

感谢大神的参考资料 http://www.9958.pw/post/nginx_config

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-13
  • 2021-12-30
  • 2021-10-24
  • 2021-08-20
  • 2022-02-25
  • 2022-03-07
猜你喜欢
  • 2022-12-23
  • 2021-06-16
  • 2021-07-21
  • 2021-04-19
  • 2022-12-23
  • 2021-08-12
相关资源
相似解决方案