首页 > PHP
Nginx下隐藏index.php入口文件
来源:TP课堂 时间:2021-03-06 点击:539

环境:

Nginx


症状:

能访问:www.abc.com/index.php/index/index/about

不能访问:www.abc.com/index/index/about


对症下药:


此代码已经历千百项目锤炼,可放心使用。

添加到E:\phpstudy_pro\Extensions\Nginx1.15.11\conf\vhosts\你的项目

 if (!-e $request_filename) {

     rewrite  ^/index.php(.*)$  /index.php?s=/$1  last;

     rewrite  ^/(.*)$  /index.php?s=/$1  last;

     break;

 }


宝塔:


宝塔一样样的:


image.png