首先THINKPHP配置文件中设置

//url访问模式为rewrite模式
'URL_MODEL'=>'2',

然后再在nginx.conf文件中,找到这一条语句 #access_log logs/host.access.log main;
找到location /{}这个语句段落

location / {
index index.html index.htm index.php;
#如果请求既不是一个文件,也不是一个目录,则执行一下重写规则
if (!-e $request_filename)
{
#地址作为将参数rewrite到index.php上。
#rewrite ^/(.*)$ /index.php/$1;
#若是子目录则使用下面这句,将subdir改成目录名称即可。
rewrite ^/company/(.*)$ /company/index.php/$1;
}
}
然后根据自己的路径重启nginx服务器
# path/nginx -s reload

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-19
  • 2022-01-09
  • 2021-06-21
猜你喜欢
  • 2021-10-26
  • 2021-11-05
  • 2021-07-31
  • 2021-10-31
  • 2021-09-20
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案