因为自己的服务器伪静态有点问题,destonn8.0二级域名商铺资讯二级域名无法打开,于是想出解决方案,就是二级域名商铺保留,资讯和内容引入主域名。
实现方案:
找到:/include/global.func.php 中找到
function userurl($username, $qstring = '', $domain = '') {
global $CFG, $DT, $MODULE;
$URL = '';
$subdomain = 0;
if($CFG['com_domain']) $subdomain = substr($CFG['com_domain'], 0, 1) == '.' ? 1 : 2;
if($username) {
if($subdomain || $domain) {
$scheme = $DT['com_https'] ? 'https://' : 'http://';
$URL = $domain ? $scheme.$domain.'/' : ($subdomain == 1 ? $scheme.($DT['com_www'] ? 'www.' : '').$username.$CFG['com_domain'].'/' : $scheme.$CFG['com_domain'].'/'.$username.'/');
if($qstring) {
parse_str($qstring, $q);
if(isset($q['file'])) {
$URL .= $CFG['com_dir'] ? $q['file'].'/' : 'company/'.$q['file'].'/';
unset($q['file']);
}
if($q) {
if($DT['rewrite']) {
foreach($q as $k=>$v) {
$v = rawurlencode($v);
$URL .= $k.'-'.$v.'-';
}
$URL = substr($URL, 0, -1).'.shtml';
} else {
$URL .= 'index.php?';
$i = 0;
foreach($q as $k=>$v) {
$v = rawurlencode($v);
$URL .= ($i++ == 0 ? '' : '&').$k.'='.$v;
}
}
}
}
} else if($DT['rewrite']) {
$URL = DT_PATH.'com/'.$username.'/';
if($qstring) {
parse_str($qstring, $q);
if(isset($q['file'])) {
$URL .= $CFG['com_dir'] ? $q['file'].'/' : 'company/'.$q['file'].'/';
unset($q['file']);
}
if($q) {
foreach($q as $k=>$v) {
$v = rawurlencode($v);
$URL .= $k.'-'.$v.'-';
}
$URL = substr($URL, 0, -1).'.html';
}
}
} else {
$URL = DT_PATH.'index.php?homepage='.$username;
if($qstring) $URL = $URL.'&'.$qstring;
}
} else {
$URL = $MODULE[4]['linkurl'].'guest.php';
}
return $URL;
}
替换为:
function userurl($username, $qstring = '', $domain = '') {
global $CFG, $DT, $MODULE;
$URL = '';
$subdomain = 0;
if($CFG['com_domain']) $subdomain = substr($CFG['com_domain'], 0, 1) == '.' ? 1 : 2;
if($username) {
if($subdomain || $domain) {
$scheme = $DT['com_https'] ? 'https://' : 'http://';
$URL = $domain ? $scheme.$domain.'/' : ($subdomain == 1 ? $scheme.($DT['com_www'] ? 'www.' : '').$username.$CFG['com_domain'].'/' : $scheme.$CFG['com_domain'].'/'.$username.'/');
if($qstring) {
parse_str($qstring, $q);
if(isset($q['file'])) {
$URL .= $CFG['com_dir'] ? $q['file'].'/' : 'company/'.$q['file'].'/';
unset($q['file']);
}
if($q) {
if($q) {
$URL = DT_PATH.'com/'.$username.'/news/';
foreach($q as $k=>$v) {
$v = rawurlencode($v);
$URL .= $k.'-'.$v.'-';
}
$URL = substr($URL, 0, -1).'.html';
}
else {
$URL .= 'index.php?';
$i = 0;
foreach($q as $k=>$v) {
$v = rawurlencode($v);
$URL .= ($i++ == 0 ? '' : '&').$k.'='.$v;
}
}
}
}
} else if($DT['rewrite']) {
$URL = DT_PATH.'com/'.$username.'/';
if($qstring) {
parse_str($qstring, $q);
if(isset($q['file'])) {
$URL .= $CFG['com_dir'] ? $q['file'].'/' : 'company/'.$q['file'].'/';
unset($q['file']);
}
if($q) {
foreach($q as $k=>$v) {
$v = rawurlencode($v);
$URL .= $k.'-'.$v.'-';
}
$URL = substr($URL, 0, -1).'.html';
}
}
} else {
$URL = DT_PATH.'index.php?homepage='.$username;
if($qstring) $URL = $URL.'&'.$qstring;
}
} else {
$URL = $MODULE[4]['linkurl'].'guest.php';
}
return $URL;
}
这样就实现了商铺内容调取主站,又保留商铺二级域名。
演示地址:http://tongrenjianzhumobanzhichengjia.jieanzhineng.com/