diff --git a/cdn.fallback.inc b/cdn.fallback.inc
index 5b56076..3904d54 100644
--- a/cdn.fallback.inc
+++ b/cdn.fallback.inc
@@ -155,6 +155,15 @@ function _cdn_html_alter_file_url(&$html, $pattern, $search_index, $path_index,
     $prefix_string = (is_numeric($prefix)) ? $matches[$prefix][$i] : $prefix;
     $suffix_string = (is_numeric($suffix)) ? $matches[$suffix][$i] : $suffix;
 
+    // Make sure it's actually a file: don't try to alter the URL of a
+    // non-file URL!
+    if (!file_exists($path)) {
+      $router_item = menu_get_item($path);
+      if ($router_item && count($router_item['page_arguments']) == 0) {
+        continue;
+      }
+    }
+
     // Store the current path as the old path, then let cdn_file_url_alter()
     // do its magic by invoking all file_url_alter hooks. When the path hasn't
     // changed and is not already root-relative or protocol-relative, then
