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=$ last;
break;
}
}

(二级目录安装)

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

2.修改URL_MODEL连接模式

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

3.模板文件命名规范

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

上一篇:Shell-13--while和until


下一篇:python 之 计数器(counter)