Ke361开源淘宝客系统搬迁需要修改的文件,更换空间或者主机后需要修改的文件主要有两处。
1.修改/Application/Common/Conf文件夹中的config.php文件,其中的"数据库配置"信息修改成自己的数据库信息:
/* 数据库配置 */
'DB_TYPE' => 'mysql', // 数据库类型
'DB_HOST' => '127.0.0.1', // 服务器地址
'DB_NAME' => 'root', // 数据库名
'DB_USER' => 'root', // 用户名
'DB_PWD' => '123456', // 密码
2.修改/Application/User/Conf文件夹中的config.php文件,其中的“数据库链接”信息修改成自己的数据库信息:
define('UC_DB_DSN', 'mysql://root:123456@127.0.0.1:3306/root'); // 数据库连接,使用Model方式调用API必须配置此项
如果第二步没有修改会导致后台管理用户无法登录,这是由于oneThink把user模块单独使用一个数据库配置文件,路径地址:User/Conf/config.php修改配置参数,清除缓存即可。
更换主机后,网站经过上述两步基本就完成,但是由于Ke361开源淘宝客系统使用的是thinkphp的内核,所以在伪静态的处理上还需要注意:
1.需要将/Application/Home/Conf目录下的config.php文件最后一段修改成如下(注意:红色部分标注的信息是需要手动添加上去的):
'LIST_ROWS' => 12,
'URL_ROUTER_ON' => true,
'URL_MODEL' => 2,
'URL_PATHINFO_DEPR' => '-',
'URL_ROUTE_RULES' => array( //定义路由规则
'article/:id\d' => 'Article/detail',
'goods/:id\d' => 'Goods/info',
'pointsmall/:id\d' => 'PointsMall/info',
'topic/:id\d' => 'Topic/detail',
'category/:category' => 'Article/index',
2.需要将伪静态信息写入.htaccess文件中,信息如下:
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>
注意:如果打开网站的网址出现“access denied”,由于ThinkPHP默认的.htaccess并不支持apache2.4,所以需要把.htaccess信息修改成如下:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?s=/$1 [QSA,PT,L]
</IfModule>
nginx静态信息规则如下:
location / {
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
}
经过以上步骤,网站就迁移好了。