我是靠谱客的博主 沉默大山,这篇文章主要介绍nginx下tp6多应用URL隐藏php入口文件,现在分享给大家,希望可以做个参考。

前台原URL:https://www.miyuwu.com/index.php/list,目标效果https://www.miyuwu.com/list

后台原URL:https://www.miyuwu.com/admin.php/list,目标效果https://www.miyuwu.com/admin/list

1、增加入口文件

在public目录下新建后台入口文件admin.php,可以直接复制index.php

2、修改index.php

$response = $http->run();  改成  $response = $http->name('index')->run();

3、配置nginx

location / {
    index index.php index.html error/index.html;
    #隐藏index.php
    if ( !-e $request_filename) {
         rewrite ^/admin/(.*)$ /admin.php/$1 last;
         rewrite ^/(.*)$ /index.php/$1 last;
    }                              
}

4、重启nginx

搞定~

最后

以上就是沉默大山最近收集整理的关于nginx下tp6多应用URL隐藏php入口文件的全部内容,更多相关nginx下tp6多应用URL隐藏php入口文件内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(116)

评论列表共有 0 条评论

立即
投稿
返回
顶部