static public function buildSecondDomainUrl($sdomain, $url=null)
	{
	    $url = static::getRootUrl($url);
	    $parts = parse_url($url);
	    $names = explode('.', $parts['host']);
	    if ($names[0] == 'www') {
	        array_shift($names);
	    }
	    if ($sdomain != $names[0]) {
	        array_unshift($names, $sdomain);
	    }
	    $host = implode('.', $names);
	    
	    $url = $parts['scheme'] . '://' . $host;
	    $port = isset($parts['port']) ? $parts['port'] : null;
	    if ($port && $port != 80 && $port != 443) {
	        $url .= ':'.$port;
	    }
	    
	    return $url;
	}
static public function buildSecondDomainUrl($sdomain, $url=null)
	{
	    $url = static::getRootUrl($url);
	    $parts = parse_url($url);
	    $names = explode('.', $parts['host']);
	    if ($names[0] == 'www') {
	        array_shift($names);
	    }
	    if ($sdomain != $names[0]) {
	        array_unshift($names, $sdomain);
	    }
	    $host = implode('.', $names);
	    
	    $url = $parts['scheme'] . '://' . $host;
	    $port = isset($parts['port']) ? $parts['port'] : null;
	    if ($port && $port != 80 && $port != 443) {
	        $url .= ':'.$port;
	    }
	    
	    return $url;
	}
static public function buildSecondDomainUrl ( $ sdomain , $ url = null ) { $ url = static :: getRootUrl ( $ url ) ; $ parts = parse_url ( $ url ) ; $ names = explode ( '.' , $ parts [ 'host' ] ) ; if ( $ names [ 0 ] == 'www' ) { array_shift ( $ names ) ; } if ( $ sdomain != $ names [ 0 ] ) { array_unshift ( $ names , $ sdomain ) ; } $ host = implode ( '.' , $ names ) ; $ url = $ parts [ 'scheme' ] . '://' . $ host ; $ port = isset ( $ parts [ 'port' ] ) ? $ parts [ 'port' ] : null ; if ( $ port && $ port != 80 && $ port != 443 ) { $ url .= ':' . $ port ; } return $ url ; }
build seconed domain url
@param  string $sdomain
@param  string $url
@return string
build seconed domain url