宝塔面板Nginx环境下配置TP6项目隐藏index.php

1 阅读1分钟
  • 软件商店中安装nginx服务器,需要先卸载apache服务器
  • 选择网站的设置,找到配置文件一栏
  • 在配置文件结尾处添加TP6隐藏index.php(nginx)版:
# 正确隐藏 index.php(TP6 专用)
    location / {
        if (!-f $request_filename) {
   		    rewrite  ^(.*)$  /index.php?s=/$1  last;
        }
    }

如图: 屏幕截图 2026-03-30 193022.png