zoukankan      html  css  js  c++  java
  • destonn8.0二级域名商铺资讯引入主域名实现方案

       因为自己的服务器伪静态有点问题,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/

    千行代码,Bug何处藏。 纵使上线又怎样,朝令改,夕断肠。
  • 相关阅读:
    auto_ptr(转载)
    OSG在VS2008下的配置安装
    没有找到MSVCR80.dll (转)
    获取程序数据路径(转)
    vc中error LNK2001:unresolved external symbol _WinMain@16的解决方法(转)
    wxWidgets编程笔记二(samples使用设置)
    关于简繁转换的工作以及校正转换词汇表的设计
    汉文博士简繁汉字转换功能测试版已经上线
    感谢wangyanhan和sanwsw网友为汉文博士制作数据库
    汉文博士新增四角号码检索字典
  • 原文地址:https://www.cnblogs.com/68xi/p/15392222.html
Copyright © 2011-2022 走看看