今天博主遇到了一个很奇葩的问题,电脑下载了一个phpstudy搭建网站,框架用的是tp,但是除了输入域名能访问,其他页面都访问不了

经过博主的疯狂问大佬,以及百度,终于解决了这个问题

 

这次出现问题的原因为重定向规则出现了问题

首先,打开phpstudy设置,点击配置文件,找到vhosts.conf

phpstudy搭建网站只能访问首页,其他路由访问404

 

 

选择你异常的网站,点进去,把以下代码黏贴到 location  里,然后重启nginx即可

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

 

如图:

phpstudy搭建网站只能访问首页,其他路由访问404

 

相关文章:

  • 2021-11-30
  • 2022-12-23
  • 2022-12-23
  • 2021-12-16
  • 2021-08-13
  • 2021-04-04
  • 2022-12-23
  • 2021-10-07
猜你喜欢
  • 2022-12-23
  • 2021-11-25
  • 2021-10-15
  • 2021-07-14
  • 2021-09-22
  • 2021-11-30
  • 2022-12-23
相关资源
相似解决方案