nginx下tp6多应用URL隐藏php入口文件

阅读 217

2022-08-06


前台原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 搞定~

精彩评论(0)

0 0 举报