--- wordpress-https-1.9.3-dev.php 2011-08-29 19:57:06.000000000 -0700 +++ wordpress-https.php 2011-08-29 22:04:10.000000000 -0700 @@ -331,7 +331,10 @@ for ($i = 0; $i<=sizeof($matches[0]); $i++) { $html = $matches[0][$i]; $url = $matches[1][$i]; - $buffer = str_replace($html, str_replace($url, $this->replace_https($url), $html), $buffer); + + if (strpos($html, $url) != strpos($html, $this->https_url)) { // Ensure Shared SSL Host URL isn't already there + $buffer = str_replace($html, str_replace($url, $this->https_url, $html), $buffer); + } } } @@ -635,7 +638,8 @@ * @return string $string */ function replace_http_url($string) { - preg_match_all('/(http|https):\/\/[\/-\w\.,#?=\+&%;:\d]+/im', $string, $url); + preg_match_all('/((http|https):\/\/[^\/\s]+)[\/-\w\.,#?=\+&%;:\d]*/im', $string, $url); + $base_url = $url[1][0]; $url = $url[0][0]; // If URL matches home_url, but lacks www, add www @@ -648,8 +652,7 @@ } // Replace the HTTPS version of the domain with $this->https_url for Shared SSL - $string = str_replace($this->replace_http($this->http_url), $this->https_url, $string); - $string = str_replace($this->http_url, $this->https_url, $string); + $string = str_replace($base_url, $this->https_url, $string); return $string; } @@ -882,4 +885,4 @@ if ( class_exists('WordPressHTTPS') ) { $wordpress_https = new WordPressHTTPS(); register_activation_hook( __FILE__, array(&$wordpress_https, 'install')); -} \ No newline at end of file +}