174,175c174,185 < if ($url_parts['port'] !== 80) { < $out .= ':' . $url_parts['port']; --- > switch( (!empty($url_parts['scheme'])? strtolower($url_parts['scheme']):'http') ) { // Default scheme to http if not specified > case 'https': { > if( $url_parts['port'] !== 443 ) { > $out .= ':' . $url_parts['port']; // Handle custom https scheme port > } > }; break; > case 'http': > default: { > if( $url_parts['port'] !== 80 ) { > $out .= ':' . $url_parts['port']; // Handle custom port > }; > }