﻿diff --git modules/openid/openid.inc modules/openid/openid.inc
index 48af766..3a1515f 100644
--- modules/openid/openid.inc
+++ modules/openid/openid.inc
@@ -372,10 +372,13 @@ function _openid_nonce() {
  */
 function _openid_link_href($rel, $html) {
   $rel = preg_quote($rel);
-  preg_match('|<link\s+rel=["\'](.*)' . $rel . '(.*)["\'](.*)/?>|iUs', $html, $matches);
-  if (isset($matches[3])) {
-    preg_match('|href=["\']([^"]+)["\']|iU', $matches[3], $href);
-    return trim($href[1]);
+  preg_match_all('|<link\s(.*)/?>|iUs', $html, $matches);
+  foreach ($matches[1] as $attributes) {
+    if(preg_match('|rel=["\'].*' . $rel . '.*["\'].*|iUs', $attributes)) {
+      if (preg_match('|href=["\']([^"]+)["\']|iU', $attributes, $href)) {
+        return trim($href[1]);
+      }
+    }
   }
   return FALSE;
 }
