我是靠谱客的博主 沉默大山,最近开发中收集的这篇文章主要介绍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入口文件所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

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

评论列表共有 0 条评论

立即
投稿
返回
顶部