Script for 404 random page found

Some people have been wondering how I did the random selection of 404 page not found messages that are used on this web site.

So, here is the nice little PHP script that I use here to redirect randomly to one of the right pages:

<?PHP
	$address_list = array(
		"/404/404-01.php",
		"/404/404-02.php",
		"/404/404-03.php",
		"/404/404-04.php",
		"/404/404-05.php",
		"/404/404-06.php",
/*		"/404/404-07.php",	*/
		"/404/404-08.php",
		"/404/404-09.php",
		"/404/404-10.php",
		"/404/404-11.php",
		"/404/404-12.php",
		"/404/404-13.php",
		"/404/404-14.php",
		"/404/404-15.php",
		"/404/404-16.php",
		"/404/404-17.php",
		"/404/404-18.php",
		"/404/404-19.php",
		"/404/404-20.php",
		"/404/404-21.php",
		"/404/404-22.php",
		"/404/404-23.php",
		"/404/404-00.php"
	);
	srand((double)microtime()*1000000); 
	$randomtopic = rand(0,count($address_list));
	header('Location: '.$address_list[$randomtopic]);
	exit;
?>

You can re-use it on your own web site if you want to. It’s free.

2 comments for “Script for 404 random page found

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.