uniapp开发h5以及thinkphp5短链系统路由配置
uniapp开发好的h5代码通过HbuildX工具:发行-》网站-PC Web或手机H5,如下图配置好网站名称和网址:将打包好的web站点目录上传到宝塔linux服务器thinkphp5站点根目录的public目录中解压并将web目录重命名为h5,进入宝塔面板站点设置内配置伪静态规则,如下图:
代码如下:
location ~* (runtime|application)/{
return 403;
}
location / {
if (!-e $request_filename){
rewrite^(.*)$/index.php?s=$1last; break;
}
}
location /h5 {
root/data/t6.jvche.net/public/h5;
try_files $uri $uri/ /index.html last;
}
关于短链系统则需要再thinkphp5的application目录中的route.php中配置路由,短链格式为:t6.jvche.net/ssjsodjh,如下图所示:
代码如下:
<?php
use think\Route;
Route::any(':name', 'index/index/shortlink', ['name' => '+']);这样就完成了h5站点和短链路由设置。
页:
[1]