fix podcast redirection
[noxon-gateway.git] / www / deredirect.php
index 5b90e1dfa6449111bf908fc006df5f14ed09f26d..a8c630b0d916ae22a1122aada947d1d61958a7c5 100644 (file)
@@ -17,7 +17,10 @@ function getFinalUrl($url)
     //get_headers follows redirects automatically
     $headers = get_headers($url, 1);
     if ($headers !== false && isset($headers['Location'])) {
-        return end($headers['Location']);
+        if (is_array($headers['Location'])) {
+            return end($headers['Location']);
+        }
+        return $headers['Location'];
     }
     return $url;
 }