如题:

代码

location / {


        root   /项目目录/;
        index  index.php;

        if (-f $request_filename/index.php){
                rewrite (.*) $1/index.php;
        }
        if (!-f $request_filename){
                rewrite (.*) /index.php;
        }

      #如果请求既不是一个文件,也不是一个目录,则执行一下重写规则 thinkphp 部署到linux 下常用
      if (!-e $request_filename)
      {
        #地址作为将参数rewrite到index.php上。
        rewrite ^/(.*)$ /index.php/$1;
        #若是子目录则使用下面这句,将subdir改成目录名称即可。
        #rewrite ^/subdir/(.*)$ /subdir/index.php/$1;
      }




}

就这么简单

 

相关文章:

  • 2021-10-11
  • 2022-12-23
  • 2022-12-23
  • 2021-05-15
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-30
  • 2021-05-20
相关资源
相似解决方案