{"id":619,"date":"2007-06-14T12:58:43","date_gmt":"2007-06-14T11:58:43","guid":{"rendered":"http:\/\/www.roumazeilles.net\/news\/en\/wordpress\/2007\/06\/14\/script-for-404-random-page-found\/"},"modified":"2007-06-14T13:59:27","modified_gmt":"2007-06-14T11:59:27","slug":"script-for-404-random-page-found","status":"publish","type":"post","link":"https:\/\/www.roumazeilles.net\/news\/en\/wordpress\/2007\/06\/14\/script-for-404-random-page-found\/","title":{"rendered":"Script for 404 random page found"},"content":{"rendered":"<p>Some people have been wondering how I did the random selection of <a href=\"\/404.php\">404 page not found<\/a> messages that are used on this web site.<\/p>\n<p>So, here is the nice little PHP script that I use here to redirect randomly to one of the right pages:<\/p>\n<pre lang=\"php\">\r\n&lt;?PHP\r\n\t$address_list = array(\r\n\t\t\"\/404\/404-01.php\",\r\n\t\t\"\/404\/404-02.php\",\r\n\t\t\"\/404\/404-03.php\",\r\n\t\t\"\/404\/404-04.php\",\r\n\t\t\"\/404\/404-05.php\",\r\n\t\t\"\/404\/404-06.php\",\r\n\/*\t\t\"\/404\/404-07.php\",\t*\/\r\n\t\t\"\/404\/404-08.php\",\r\n\t\t\"\/404\/404-09.php\",\r\n\t\t\"\/404\/404-10.php\",\r\n\t\t\"\/404\/404-11.php\",\r\n\t\t\"\/404\/404-12.php\",\r\n\t\t\"\/404\/404-13.php\",\r\n\t\t\"\/404\/404-14.php\",\r\n\t\t\"\/404\/404-15.php\",\r\n\t\t\"\/404\/404-16.php\",\r\n\t\t\"\/404\/404-17.php\",\r\n\t\t\"\/404\/404-18.php\",\r\n\t\t\"\/404\/404-19.php\",\r\n\t\t\"\/404\/404-20.php\",\r\n\t\t\"\/404\/404-21.php\",\r\n\t\t\"\/404\/404-22.php\",\r\n\t\t\"\/404\/404-23.php\",\r\n\t\t\"\/404\/404-00.php\"\r\n\t);\r\n\tsrand((double)microtime()*1000000); \r\n\t$randomtopic = rand(0,count($address_list));\r\n\theader('Location: '.$address_list[$randomtopic]);\r\n\texit;\r\n?&gt;<\/pre>\n<p>You can re-use it on your own web site if you want to. It&#8217;s free.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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: &lt;?PHP $address_list = array( &#8220;\/404\/404-01.php&#8221;, &#8220;\/404\/404-02.php&#8221;, &#8220;\/404\/404-03.php&#8221;, &#8220;\/404\/404-04.php&#8221;, &#8220;\/404\/404-05.php&#8221;, &#8220;\/404\/404-06.php&#8221;, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[42,37,57],"tags":[],"class_list":["post-619","post","type-post","status-publish","format-standard","hentry","category-blog","category-create-a-web-site","category-php"],"_links":{"self":[{"href":"https:\/\/www.roumazeilles.net\/news\/en\/wordpress\/wp-json\/wp\/v2\/posts\/619","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.roumazeilles.net\/news\/en\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.roumazeilles.net\/news\/en\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.roumazeilles.net\/news\/en\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.roumazeilles.net\/news\/en\/wordpress\/wp-json\/wp\/v2\/comments?post=619"}],"version-history":[{"count":0,"href":"https:\/\/www.roumazeilles.net\/news\/en\/wordpress\/wp-json\/wp\/v2\/posts\/619\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.roumazeilles.net\/news\/en\/wordpress\/wp-json\/wp\/v2\/media?parent=619"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.roumazeilles.net\/news\/en\/wordpress\/wp-json\/wp\/v2\/categories?post=619"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.roumazeilles.net\/news\/en\/wordpress\/wp-json\/wp\/v2\/tags?post=619"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}