#!/usr/local/php/5.3dev/bin/php $newUrl\n" ); } else { // This is the format that Yahoo!Maps uses // Do the math to calculate the OSM tile // coordinates from the Yahoo!Maps one $z = $queryParts['z'] - 1; $x = $queryParts['x']; $y = pow( 2, $z - 1 ) - $queryParts['y'] - 1; // Assemble new URL and write log line $newUrl = "http://b.tile.openstreetmap.org/$z/$x/$y.png"; fwrite( $a, "REDIR: $parts[0] => $newUrl\n" ); } } else { $newUrl = $parts[0]; fwrite($a, "NORMAL: $newUrl\n"); } // Output the rewritten (or original) URL echo $newUrl, "\n"; } while( true ); ?>