diff --git a/print.module b/print.module index 8bd3fc47809fcc01ae67e1f4bb30142c94a2d893..e29ee1ccf459254cc014bfe363d94f7050d4b566 100644 --- a/print.module +++ b/print.module @@ -536,7 +536,13 @@ function print_rewrite_urls($matches) { $clean_url = (bool)variable_get('clean_url', '0'); if (substr($url, 0, 1) == "/") { // If it starts with '/' just append it to the server name - $server = substr($base_url, 0, strpos($base_url, '/', 7)); + $max = strpos($base_url, '/', 7); + if ($max === false) { + $server = $base_url; + } + else { + $server = substr($base_url, 0, $max); + } $newurl = $server .'/'. trim(urldecode($url), "/"); } elseif ((!$clean_url) && (preg_match("/^[index.php]?\?q=.*/i", $url))) {