如何在百度云虚拟机中配置thinkphp5,并且url去掉index.php

第一步:将public目录下的index.php移到和public同级目录下,【或者直接在public同级目录下新建一个index.php】

第二步:那么这个新的index.php文件的内容如下:

<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
// [ 应用入口文件 ]
// 定义应用目录
define('APP_PATH', __DIR__ . '/application/');
// 加载框架引导文件
require __DIR__ . '/thinkphp/start.php';


第三步:在bcloud_nginx_user.conf文件中配置重写规则,文件内容如下

location /{
if (!-e $request_filename){
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
}


最后一步:输入访问地址,此处我访问的是后台admin,我是这么访问的:此处域名举例为www.demo.com,
输入这个地址http://www.demo.com/admin/login/index.html,我就访问到我对应要看的页面,配置就是这么简单,演示到此,如下有图片说明。

以上步骤,图片说明:

 

posted @ 2018-07-26 14:41  Rumble_lu  阅读(362)  评论(0编辑  收藏  举报