Code – An Explanation
Posted: Sat 14 May, 2005 Filed under: D4D™, Geeky Leave a comment »OK, it’s not really all that difficult…
1 <?php
2 if (substr($_SERVER[‘HTTP_REFERER’],0,20) == “http://images.google”) {
3 header(‘Location: http://www.dummies-for-destruction.co.uk/404.htm’);
4 } else {
5
6 }
7 ?>
This entire lot just basically says “if the first 20 characters of the HTTP referrer are http://images.google then go to a non-existent page, otherwise do sod all” – and that’s all that’s needed.
The best thing is that this works for all Google’s Images searches, regardless of source country. Sounds good to me.