私人领地

thinkphp 3.2 linux二级目录安装

详解:http://document.thinkphp.cn/manual_3_2.html#url_rewrite

注意:linux系统对大小写敏感

 

服务器系统:linux (阿里云服务器)

thinkphp 版本: 3.2

1. 修改nginx配置 (提示找不到控制器,页面空白等问题) 阿里云文件ftp位置:/etc/nginx/conf.d/default.conf

注意:在Nginx低版本中,是不支持PATHINFO的,但是可以通过在Nginx.conf中配置转发规则实现(如果服务器支持pathinfo则不用以下代码):

增加代码

(根目录下安装)

 location / { // …..省略部分代码
   if (!-e $request_filename) {
   rewrite  ^(.*)$  /index.php?s=$1  last;
   break;
    }
 }

(二级目录安装)

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

 

2.修改URL_MODEL连接模式

'URL_MODEL'                =>'1',    // config.php文件中

 

3.模板文件命名规范

goods_index.html 错误(linux系统对大小写敏感);Goods_index.html 正确

 

posted @ 2016-07-07 12:02  狂奔的蜗牛Snails  阅读(1852)  评论(0编辑  收藏  举报